Exception: Sumi::Executor::Error
- Inherits:
-
Sumi::Error
- Object
- StandardError
- Sumi::Error
- Sumi::Executor::Error
- Defined in:
- toplevel/lib/sumi/executor/error.rb
Overview
Wraps an exception raised while executing Sumi 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 Sumi source set.
Methods inherited from Sumi::Error
Constructor Details
#initialize(error, stack) ⇒ void
Builds an executor error wrapper.
27 28 29 30 31 32 |
# File 'toplevel/lib/sumi/executor/error.rb', line 27 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.
47 48 49 |
# File 'toplevel/lib/sumi/executor/error.rb', line 47 def cause @cause end |
Instance Method Details
#load_backtrace ⇒ Array<String>
Returns backtrace entries that belong to the visited Sumi source set.
37 38 39 40 41 42 43 |
# File 'toplevel/lib/sumi/executor/error.rb', line 37 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 |