Class: Mocktail::CleansBacktrace

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mocktail/share/cleans_backtrace.rb,
lib/mocktail/sorbet/mocktail/share/cleans_backtrace.rb

Instance Method Summary collapse

Instance Method Details

#clean(error) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/mocktail/share/cleans_backtrace.rb', line 5

def clean(error)
  raise error
rescue error.class => e
  e.tap do |e|
    e.set_backtrace(e.backtrace.drop_while { |frame|
      frame.start_with?(BASE_PATH, BASE_PATH) || frame.match?(/[\\|\/]sorbet-runtime.*[\\|\/]lib[\\|\/]types[\\|\/]private/)
    })
  end
end