Exception: ViewModel::DeserializationError::AssociatedNotFound
- Inherits:
-
NotFound
- Object
- StandardError
- AbstractError
- AbstractErrorWithBlame
- ViewModel::DeserializationError
- NotFound
- ViewModel::DeserializationError::AssociatedNotFound
- Defined in:
- lib/view_model/deserialization_error.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#missing_nodes ⇒ Object
readonly
Returns the value of attribute missing_nodes.
Attributes inherited from AbstractErrorWithBlame
Instance Method Summary collapse
- #detail ⇒ Object
-
#initialize(association, missing_nodes, blame_nodes) ⇒ AssociatedNotFound
constructor
A new instance of AssociatedNotFound.
- #meta ⇒ Object
Methods inherited from ViewModel::DeserializationError
Methods inherited from AbstractError
#aggregation?, #causes, #code, #exception, #status, #title, #to_s, #view
Constructor Details
#initialize(association, missing_nodes, blame_nodes) ⇒ AssociatedNotFound
Returns a new instance of AssociatedNotFound.
196 197 198 199 200 |
# File 'lib/view_model/deserialization_error.rb', line 196 def initialize(association, missing_nodes, blame_nodes) @association = association @missing_nodes = Array.wrap(missing_nodes) super(blame_nodes) end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
194 195 196 |
# File 'lib/view_model/deserialization_error.rb', line 194 def association @association end |
#missing_nodes ⇒ Object (readonly)
Returns the value of attribute missing_nodes.
194 195 196 |
# File 'lib/view_model/deserialization_error.rb', line 194 def missing_nodes @missing_nodes end |
Instance Method Details
#detail ⇒ Object
202 203 204 205 206 |
# File 'lib/view_model/deserialization_error.rb', line 202 def detail errors = missing_nodes.map(&:to_s).join(', ') "Couldn't find requested member node(s) in association '#{association}': "\ "#{errors}" end |
#meta ⇒ Object
208 209 210 211 |
# File 'lib/view_model/deserialization_error.rb', line 208 def super.merge(association: association, missing_nodes: format_references(missing_nodes)) end |