Exception: JSONAPI::Exceptions::InvalidFieldValue
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Error
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(field, value, error_object_overrides = {}) ⇒ InvalidFieldValue
constructor
A new instance of InvalidFieldValue.
Methods inherited from Error
Constructor Details
#initialize(field, value, error_object_overrides = {}) ⇒ InvalidFieldValue
Returns a new instance of InvalidFieldValue.
239 240 241 242 243 |
# File 'lib/jsonapi/exceptions.rb', line 239 def initialize(field, value, error_object_overrides = {}) @field = field @value = value super(error_object_overrides) end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
237 238 239 |
# File 'lib/jsonapi/exceptions.rb', line 237 def field @field end |
#value ⇒ Object
Returns the value of attribute value.
237 238 239 |
# File 'lib/jsonapi/exceptions.rb', line 237 def value @value end |
Instance Method Details
#errors ⇒ Object
245 246 247 248 249 250 251 252 253 |
# File 'lib/jsonapi/exceptions.rb', line 245 def errors [create_error_object(code: JSONAPI::INVALID_FIELD_VALUE, status: :bad_request, title: I18n.translate('jsonapi-resources.exceptions.invalid_field_value.title', default: 'Invalid field value'), detail: I18n.translate('jsonapi-resources.exceptions.invalid_field_value.detail', default: "#{value} is not a valid value for #{field}.", value: value, field: field))] end |