Class: Sevgi::Executor::Error

Inherits:
Sevgi::Error
  • Object
show all
Defined in:
lib/sevgi/executor/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, scope) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
# File 'lib/sevgi/executor/error.rb', line 8

def initialize(error, scope)
  @error = error
  @scope = scope

  super(error.message)
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



6
7
8
# File 'lib/sevgi/executor/error.rb', line 6

def error
  @error
end

#scopeObject (readonly)

Returns the value of attribute scope.



6
7
8
# File 'lib/sevgi/executor/error.rb', line 6

def scope
  @scope
end

Instance Method Details

#backtrace!Object



15
16
17
18
19
20
# File 'lib/sevgi/executor/error.rb', line 15

def backtrace!
  error
    .backtrace
    .select { |line| stack.any? { line.start_with?(::File.expand_path(it)) } }
    .map { |line| line.delete_prefix("#{::Dir.pwd}/") }
end

#stackObject



22
# File 'lib/sevgi/executor/error.rb', line 22

def stack = scope.stack