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.
242 243 244 245 246 |
# File 'lib/jsonapi/exceptions.rb', line 242 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.
240 241 242 |
# File 'lib/jsonapi/exceptions.rb', line 240 def field @field end |
#value ⇒ Object
Returns the value of attribute value.
240 241 242 |
# File 'lib/jsonapi/exceptions.rb', line 240 def value @value end |
Instance Method Details
#errors ⇒ Object
248 249 250 251 252 253 254 255 256 |
# File 'lib/jsonapi/exceptions.rb', line 248 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 |