Exception: Exception
- Defined in:
- lib/active_support/core_ext/exception.rb
Overview
TODO: Turn all this into using the BacktraceCleaner.
Direct Known Subclasses
Constant Summary collapse
- TraceSubstitutions =
[]
- FrameworkStart =
/action_controller\/dispatcher\.rb/.freeze
- FrameworkRegexp =
/generated|vendor|dispatch|ruby|script\/\w+/.freeze
Instance Method Summary collapse
- #application_backtrace ⇒ Object
- #clean_backtrace ⇒ Object
-
#clean_message ⇒ Object
:nodoc:.
- #framework_backtrace ⇒ Object
Instance Method Details
#application_backtrace ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/active_support/core_ext/exception.rb', line 27 def application_backtrace before_framework_frame = nil before_application_frame = true trace = clean_backtrace.reject do |line| before_framework_frame ||= (line =~ FrameworkStart) non_app_frame = (line =~ FrameworkRegexp) before_application_frame = false unless non_app_frame before_framework_frame || (non_app_frame && !before_application_frame) end # If we didn't find any application frames, return an empty app trace. before_application_frame ? [] : trace end |
#clean_backtrace ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/active_support/core_ext/exception.rb', line 19 def clean_backtrace backtrace.collect do |line| Pathname.clean_within(TraceSubstitutions.inject(line) do |result, (regexp, sub)| result.gsub regexp, sub end) end end |
#clean_message ⇒ Object
:nodoc:
11 12 13 |
# File 'lib/active_support/core_ext/exception.rb', line 11 def Pathname.clean_within end |
#framework_backtrace ⇒ Object
42 43 44 |
# File 'lib/active_support/core_ext/exception.rb', line 42 def framework_backtrace clean_backtrace.grep FrameworkRegexp end |