Exception: Mirah::NodeError
- Inherits:
-
MirahError
- Object
- StandardError
- MirahError
- Mirah::NodeError
- Defined in:
- lib/mirah/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#node ⇒ Object
Returns the value of attribute node.
Attributes inherited from MirahError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, node = nil) ⇒ NodeError
constructor
A new instance of NodeError.
- #position ⇒ Object
Methods inherited from MirahError
Constructor Details
#initialize(message, node = nil) ⇒ NodeError
Returns a new instance of NodeError.
36 37 38 39 40 |
# File 'lib/mirah/errors.rb', line 36 def initialize(, node=nil) position = node.position if node super(, position) @node = node end |
Instance Attribute Details
#node ⇒ Object
Returns the value of attribute node.
34 35 36 |
# File 'lib/mirah/errors.rb', line 34 def node @node end |
Class Method Details
.wrap(ex, node) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/mirah/errors.rb', line 47 def self.wrap(ex, node) case ex when NodeError ex.node ||= node ex when MirahError ex.position ||= node.position ex else new_ex = new(ex., node) new_ex.cause = ex new_ex.position ||= ex.position if ex.respond_to?(:position) new_ex.set_backtrace(ex.backtrace) new_ex end end |
Instance Method Details
#position ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/mirah/errors.rb', line 64 def position if node && node.position node.position else super end end |