Exception: Fuguta::SyntaxError
- Inherits:
-
StandardError
- Object
- StandardError
- Fuguta::SyntaxError
- Defined in:
- lib/fuguta.rb
Instance Attribute Summary collapse
-
#root_cause ⇒ Object
readonly
self.cause() is as of Ruby 2.1 so we handles root error .
-
#source ⇒ Object
readonly
self.cause() is as of Ruby 2.1 so we handles root error .
Instance Method Summary collapse
-
#initialize(root_cause, source = "") ⇒ SyntaxError
constructor
A new instance of SyntaxError.
- #message ⇒ Object
Constructor Details
#initialize(root_cause, source = "") ⇒ SyntaxError
Returns a new instance of SyntaxError.
17 18 19 20 21 22 |
# File 'lib/fuguta.rb', line 17 def initialize(root_cause, source="") super("Syntax Error") raise ArgumentError, 'root_cause' unless root_cause.is_a?(::Exception) @root_cause = root_cause @source = source end |
Instance Attribute Details
#root_cause ⇒ Object (readonly)
self.cause() is as of Ruby 2.1 so we handles root error .
15 16 17 |
# File 'lib/fuguta.rb', line 15 def root_cause @root_cause end |
#source ⇒ Object (readonly)
self.cause() is as of Ruby 2.1 so we handles root error .
15 16 17 |
# File 'lib/fuguta.rb', line 15 def source @source end |
Instance Method Details
#message ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fuguta.rb', line 24 def if @root_cause.backtrace.first =~ /:(\d+):in `/ || @root_cause.backtrace.first =~ /:(\d+)$/ line = $1.to_i end "%s from %s:%d" % [super(), @source, line] end |