Method: Cucumber::Ast::StepInvocation#filter_backtrace

Defined in:
lib/cucumber/ast/step_invocation.rb

#filter_backtrace(e) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cucumber/ast/step_invocation.rb', line 93

def filter_backtrace(e)
  return e if Cucumber.use_full_backtrace
  filtered = (e.backtrace || []).reject do |line|
    BACKTRACE_FILTER_PATTERNS.detect { |p| line =~ p }
  end
  
  if Cucumber::JRUBY && e.class.name == 'NativeException'
    # JRuby's NativeException ignores #set_backtrace.
    # We're fixing it.
    e.instance_eval do
      def set_backtrace(backtrace)
        @backtrace = backtrace
      end

      def backtrace
        @backtrace
      end
    end
  end
  e.set_backtrace(filtered)
  e
end