Exception: Exception

Defined in:
lib/svcbase/formatter.rb

Overview

add a helper method to Exception to provide a relative backtrace

Instance Method Summary collapse

Instance Method Details

#relative_backtraceObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/svcbase/formatter.rb', line 8

def relative_backtrace
  return [] unless backtrace&.is_a?(Array)
  trace = backtrace
  stack = caller
  while trace.last && stack.last && trace.last == stack.last
    trace.pop
    stack.pop
  end
  trace
end