Exception: Apia::NullFieldValueError
- Inherits:
-
RuntimeError
- Object
- StandardError
- StandardError
- RuntimeError
- Apia::NullFieldValueError
- Defined in:
- lib/apia/errors/null_field_value_error.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
- #hash ⇒ Object
- #http_status ⇒ Object
-
#initialize(field, source) ⇒ NullFieldValueError
constructor
A new instance of NullFieldValueError.
- #to_s ⇒ Object
Constructor Details
#initialize(field, source) ⇒ NullFieldValueError
Returns a new instance of NullFieldValueError.
10 11 12 13 |
# File 'lib/apia/errors/null_field_value_error.rb', line 10 def initialize(field, source) @field = field @source = source end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
8 9 10 |
# File 'lib/apia/errors/null_field_value_error.rb', line 8 def field @field end |
Instance Method Details
#hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/apia/errors/null_field_value_error.rb', line 23 def hash { code: 'null_value_for_non_null_field', description: to_s, detail: { field: { id: @field.id, name: @field.name } } } end |
#http_status ⇒ Object
19 20 21 |
# File 'lib/apia/errors/null_field_value_error.rb', line 19 def http_status 500 end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/apia/errors/null_field_value_error.rb', line 15 def to_s "Value for `#{field.name}` is null (but cannot be)" end |