Exception: JSONAPI::Exceptions::InvalidResource
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(resource, error_object_overrides = {}) ⇒ InvalidResource
constructor
A new instance of InvalidResource.
Methods inherited from Error
Constructor Details
#initialize(resource, error_object_overrides = {}) ⇒ InvalidResource
Returns a new instance of InvalidResource.
71 72 73 74 |
# File 'lib/jsonapi/exceptions.rb', line 71 def initialize(resource, error_object_overrides = {}) @resource = resource super(error_object_overrides) end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
69 70 71 |
# File 'lib/jsonapi/exceptions.rb', line 69 def resource @resource end |
Instance Method Details
#errors ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/jsonapi/exceptions.rb', line 76 def errors [create_error_object(code: JSONAPI::INVALID_RESOURCE, status: :bad_request, title: I18n.t('jsonapi-resources.exceptions.invalid_resource.title', default: 'Invalid resource'), detail: I18n.t('jsonapi-resources.exceptions.invalid_resource.detail', default: "#{resource} is not a valid resource.", resource: resource))] end |