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.
313 314 315 316 317 |
# File 'lib/jsonapi/exceptions.rb', line 313 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.
311 312 313 |
# File 'lib/jsonapi/exceptions.rb', line 311 def field @field end |
#type ⇒ Object
Returns the value of attribute type.
311 312 313 |
# File 'lib/jsonapi/exceptions.rb', line 311 def type @type end |
Instance Method Details
#errors ⇒ Object
319 320 321 322 323 324 325 326 327 |
# File 'lib/jsonapi/exceptions.rb', line 319 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 |