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
Constructor Details
#initialize(message, node = nil) ⇒ NodeError
Returns a new instance of NodeError.
15 16 17 18 19 |
# File 'lib/mirah/errors.rb', line 15 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.
13 14 15 |
# File 'lib/mirah/errors.rb', line 13 def node @node end |
Class Method Details
.wrap(ex, node) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mirah/errors.rb', line 26 def self.wrap(ex, node) if ex.kind_of?(NodeError) ex.node ||= node return ex elsif ex.kind_of?(MirahError) ex.position ||= node.position return 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) return new_ex end end |
Instance Method Details
#position ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/mirah/errors.rb', line 42 def position if node && node.position node.position else super end end |