Exception: ViewModel::DeserializationError::InvalidAttributeType
- Inherits:
-
InvalidRequest
- Object
- StandardError
- AbstractError
- AbstractErrorWithBlame
- ViewModel::DeserializationError
- InvalidRequest
- ViewModel::DeserializationError::InvalidAttributeType
- Defined in:
- lib/view_model/deserialization_error.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#expected_type ⇒ Object
readonly
Returns the value of attribute expected_type.
-
#provided_type ⇒ Object
readonly
Returns the value of attribute provided_type.
Attributes inherited from AbstractErrorWithBlame
Instance Method Summary collapse
- #detail ⇒ Object
-
#initialize(attribute, expected_type, provided_type, node) ⇒ InvalidAttributeType
constructor
A new instance of InvalidAttributeType.
- #meta ⇒ Object
Methods inherited from ViewModel::DeserializationError
Methods inherited from AbstractError
#aggregation?, #causes, #code, #exception, #status, #title, #to_s, #view
Constructor Details
#initialize(attribute, expected_type, provided_type, node) ⇒ InvalidAttributeType
Returns a new instance of InvalidAttributeType.
295 296 297 298 299 300 |
# File 'lib/view_model/deserialization_error.rb', line 295 def initialize(attribute, expected_type, provided_type, node) @attribute = attribute @expected_type = expected_type @provided_type = provided_type super([node]) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
293 294 295 |
# File 'lib/view_model/deserialization_error.rb', line 293 def attribute @attribute end |
#expected_type ⇒ Object (readonly)
Returns the value of attribute expected_type.
293 294 295 |
# File 'lib/view_model/deserialization_error.rb', line 293 def expected_type @expected_type end |
#provided_type ⇒ Object (readonly)
Returns the value of attribute provided_type.
293 294 295 |
# File 'lib/view_model/deserialization_error.rb', line 293 def provided_type @provided_type end |
Instance Method Details
#detail ⇒ Object
302 303 304 |
# File 'lib/view_model/deserialization_error.rb', line 302 def detail "Expected '#{attribute}' to be of type '#{expected_type}', was '#{provided_type}'" end |
#meta ⇒ Object
306 307 308 309 310 |
# File 'lib/view_model/deserialization_error.rb', line 306 def super.merge(attribute: attribute, expected_type: expected_type, provided_type: provided_type) end |