Class: Sevgi::Executor::Error
- Inherits:
-
Sevgi::Error
- Object
- Sevgi::Error
- Sevgi::Executor::Error
- Defined in:
- lib/sevgi/executor/error.rb
Overview
Wraps an exception raised while executing Sevgi script source.
Instance Attribute Summary collapse
-
#error ⇒ Exception
readonly
Original exception raised by script execution.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#backtrace! ⇒ Array<String>
Returns backtrace entries that belong to the Sevgi load stack.
-
#initialize(error, scope) ⇒ void
constructor
Builds an executor error wrapper.
-
#stack ⇒ Array<String>
Returns the script load stack active at failure time.
Constructor Details
#initialize(error, scope) ⇒ void
Builds an executor error wrapper.
17 18 19 20 21 22 |
# File 'lib/sevgi/executor/error.rb', line 17 def initialize(error, scope) @error = error @scope = scope super(error.) end |
Instance Attribute Details
#error ⇒ Exception (readonly)
Returns original exception raised by script execution.
11 12 13 |
# File 'lib/sevgi/executor/error.rb', line 11 def error @error end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
11 |
# File 'lib/sevgi/executor/error.rb', line 11 attr_reader :error, :scope |
Instance Method Details
#backtrace! ⇒ Array<String>
Returns backtrace entries that belong to the Sevgi load stack.
26 27 28 29 30 31 32 33 |
# File 'lib/sevgi/executor/error.rb', line 26 def backtrace! sources = stack.map { ::File.(it) } error .backtrace .select { sources.include?(::File.(it.split(":", 2).first)) } .map { |line| line.delete_prefix("#{::Dir.pwd}/") } end |
#stack ⇒ Array<String>
Returns the script load stack active at failure time.
37 |
# File 'lib/sevgi/executor/error.rb', line 37 def stack = scope.stack |