Exception: JSONAPI::Exceptions::TypeMismatch
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type, error_object_overrides = {}) ⇒ TypeMismatch
constructor
A new instance of TypeMismatch.
Methods inherited from Error
Constructor Details
#initialize(type, error_object_overrides = {}) ⇒ TypeMismatch
Returns a new instance of TypeMismatch.
297 298 299 300 |
# File 'lib/jsonapi/exceptions.rb', line 297 def initialize(type, error_object_overrides = {}) @type = type super(error_object_overrides) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
295 296 297 |
# File 'lib/jsonapi/exceptions.rb', line 295 def type @type end |
Instance Method Details
#errors ⇒ Object
302 303 304 305 306 307 308 309 |
# File 'lib/jsonapi/exceptions.rb', line 302 def errors [create_error_object(code: JSONAPI::TYPE_MISMATCH, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.type_mismatch.title', default: 'Type Mismatch'), detail: I18n.translate('jsonapi-resources.exceptions.type_mismatch.detail', default: "#{type} is not a valid type for this operation.", type: type))] end |