Exception: Structured::InputError
- Inherits:
-
StandardError
- Object
- StandardError
- Structured::InputError
- Defined in:
- lib/structured.rb
Overview
Error class when there is a defect in Structured input. This class will eventually provide more robust tracing information about where the error occurred.
Instance Attribute Summary collapse
-
#structured_stack ⇒ Object
Returns the value of attribute structured_stack.
Instance Method Summary collapse
Instance Attribute Details
#structured_stack ⇒ Object
Returns the value of attribute structured_stack.
122 123 124 |
# File 'lib/structured.rb', line 122 def structured_stack @structured_stack end |
Instance Method Details
#backtrace ⇒ Object
149 150 151 |
# File 'lib/structured.rb', line 149 def backtrace return [] end |
#cause ⇒ Object
153 154 155 |
# File 'lib/structured.rb', line 153 def cause return nil end |
#to_s ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/structured.rb', line 124 def to_s res = [ [ nil, nil ] ] return super unless @structured_stack @structured_stack.each do |item| if item.is_a?(Class) res.last[0] = item else res.push([ nil, nil ]) res.last[1] = item end end return res.map { |cls, item| case when item && cls then "\"#{item}\" (#{cls})" when item then "\"#{item}\"" when cls then "#{cls}" else nil end }.compact.join(" -> ") + ": " + super end |