Exception: JSONAPI::Exceptions::InvalidField
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type, field, error_object_overrides = {}) ⇒ InvalidField
constructor
A new instance of InvalidField.
Methods inherited from Error
Constructor Details
#initialize(type, field, error_object_overrides = {}) ⇒ InvalidField
Returns a new instance of InvalidField.
310 311 312 313 314 |
# File 'lib/jsonapi/exceptions.rb', line 310 def initialize(type, field, error_object_overrides = {}) @field = field @type = type super(error_object_overrides) end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
308 309 310 |
# File 'lib/jsonapi/exceptions.rb', line 308 def field @field end |
#type ⇒ Object
Returns the value of attribute type.
308 309 310 |
# File 'lib/jsonapi/exceptions.rb', line 308 def type @type end |
Instance Method Details
#errors ⇒ Object
316 317 318 319 320 321 322 323 324 |
# File 'lib/jsonapi/exceptions.rb', line 316 def errors [create_error_object(code: JSONAPI::INVALID_FIELD, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.invalid_field.title', default: 'Invalid field'), detail: I18n.translate('jsonapi-resources.exceptions.invalid_field.detail', default: "#{field} is not a valid field for #{type}.", field: field, type: type))] end |