Exception: JSONAPI::Exceptions::InvalidFieldValue

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, value) ⇒ InvalidFieldValue

Returns a new instance of InvalidFieldValue.



64
65
66
67
# File 'lib/jsonapi/exceptions.rb', line 64

def initialize(field, value)
  @field = field
  @value = value
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



63
64
65
# File 'lib/jsonapi/exceptions.rb', line 63

def field
  @field
end

#valueObject

Returns the value of attribute value.



63
64
65
# File 'lib/jsonapi/exceptions.rb', line 63

def value
  @value
end

Instance Method Details

#errorsObject



69
70
71
72
73
74
# File 'lib/jsonapi/exceptions.rb', line 69

def errors
  [JSONAPI::Error.new(code: JSONAPI::INVALID_FIELD_VALUE,
                       status: :bad_request,
                       title: 'Invalid field value',
                       detail: "#{value} is not a valid value for #{field}.")]
end