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. Its visited source snapshot records every source in load order; it is not the active load stack at the instant of failure.
Instance Attribute Summary collapse
-
#cause ⇒ Exception
readonly
Returns the original exception as the wrapped cause.
Instance Method Summary collapse
-
#initialize(error, stack) ⇒ void
constructor
Builds an executor error wrapper.
-
#load_backtrace ⇒ Array<String>
Returns backtrace entries that belong to the visited Sevgi source set.
Constructor Details
#initialize(error, stack) ⇒ void
Builds an executor error wrapper.
19 20 21 22 23 24 |
# File 'lib/sevgi/executor/error.rb', line 19 def initialize(error, stack) @cause = error @stack = stack.map { it.dup.freeze }.freeze super(error.) end |
Instance Attribute Details
#cause ⇒ Exception (readonly)
Returns the original exception as the wrapped cause.
39 40 41 |
# File 'lib/sevgi/executor/error.rb', line 39 def cause @cause end |
Instance Method Details
#load_backtrace ⇒ Array<String>
Returns backtrace entries that belong to the visited Sevgi source set.
29 30 31 32 33 34 35 |
# File 'lib/sevgi/executor/error.rb', line 29 def load_backtrace sources = @stack.map { ::File.(it) } Array(cause.backtrace) .select { sources.include?(::File.(it.split(":", 2).first)) } .map { |line| line.delete_prefix("#{::Dir.pwd}/") } end |