Exception: Mirah::NodeError
- Inherits:
-
MirahError
- Object
- StandardError
- MirahError
- Mirah::NodeError
- Defined in:
- lib/mirah/errors.rb
Direct Known Subclasses
InferenceError, InternalCompilerError, JVM::Compiler::Base::CompilationError, SyntaxError
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.
34 35 36 37 38 |
# File 'lib/mirah/errors.rb', line 34 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.
32 33 34 |
# File 'lib/mirah/errors.rb', line 32 def node @node end |
Class Method Details
.wrap(ex, node) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mirah/errors.rb', line 45 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
62 63 64 65 66 67 68 |
# File 'lib/mirah/errors.rb', line 62 def position if node && node.position node.position else super end end |