Exception: ViewModel::AbstractErrorWithBlame
- Inherits:
-
AbstractError
- Object
- StandardError
- AbstractError
- ViewModel::AbstractErrorWithBlame
- Defined in:
- lib/view_model/error.rb
Overview
For errors associated with specific viewmodel nodes, include metadata describing the node to blame.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#initialize(blame_nodes) ⇒ AbstractErrorWithBlame
constructor
A new instance of AbstractErrorWithBlame.
- #meta ⇒ Object
Methods inherited from AbstractError
#aggregation?, #causes, #code, #detail, #exception, #status, #title, #to_s, #view
Constructor Details
#initialize(blame_nodes) ⇒ AbstractErrorWithBlame
Returns a new instance of AbstractErrorWithBlame.
98 99 100 101 102 103 104 105 |
# File 'lib/view_model/error.rb', line 98 def initialize(blame_nodes) @nodes = Array.wrap(blame_nodes) unless @nodes.all? { |n| n.is_a?(ViewModel::Reference) } raise ArgumentError.new("#{self.class.name}: 'blame_nodes' must all be of type ViewModel::Reference") end super() end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
96 97 98 |
# File 'lib/view_model/error.rb', line 96 def nodes @nodes end |
Instance Method Details
#meta ⇒ Object
107 108 109 110 111 |
# File 'lib/view_model/error.rb', line 107 def { nodes: format_references(nodes), } end |