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.
295 296 297 298 |
# File 'lib/jsonapi/exceptions.rb', line 295 def initialize(type, error_object_overrides = {}) @type = type super(error_object_overrides) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
293 294 295 |
# File 'lib/jsonapi/exceptions.rb', line 293 def type @type end |
Instance Method Details
#errors ⇒ Object
300 301 302 303 304 305 306 307 |
# File 'lib/jsonapi/exceptions.rb', line 300 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 |