Exception: Exception
- Defined in:
- lib/active_support/dependencies.rb,
lib/active_support/core_ext/exception.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- TraceSubstitutions =
[]
- FrameworkRegexp =
/generated|vendor|dispatch|ruby|script\/\w+/
Instance Method Summary collapse
- #application_backtrace ⇒ Object
-
#blame_file!(file) ⇒ Object
:nodoc:.
- #blamed_files ⇒ Object
- #clean_backtrace ⇒ Object
- #clean_message ⇒ Object
- #copy_blame!(exc) ⇒ Object
- #describe_blame ⇒ Object
- #framework_backtrace ⇒ Object
Instance Method Details
#application_backtrace ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/active_support/core_ext/exception.rb', line 25 def application_backtrace before_application_frame = true trace = clean_backtrace.reject do |line| non_app_frame = (line =~ FrameworkRegexp) before_application_frame = false unless non_app_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 |
#blame_file!(file) ⇒ Object
:nodoc:
536 537 538 |
# File 'lib/active_support/dependencies.rb', line 536 def blame_file!(file) (@blamed_files ||= []).unshift file end |
#blamed_files ⇒ Object
540 541 542 |
# File 'lib/active_support/dependencies.rb', line 540 def blamed_files @blamed_files ||= [] end |
#clean_backtrace ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/active_support/core_ext/exception.rb', line 17 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
10 11 12 |
# File 'lib/active_support/core_ext/exception.rb', line 10 def Pathname.clean_within end |
#copy_blame!(exc) ⇒ Object
549 550 551 552 |
# File 'lib/active_support/dependencies.rb', line 549 def copy_blame!(exc) @blamed_files = exc.blamed_files.clone self end |
#describe_blame ⇒ Object
544 545 546 547 |
# File 'lib/active_support/dependencies.rb', line 544 def describe_blame return nil if blamed_files.empty? "This error occurred while loading the following files:\n #{blamed_files.join "\n "}" end |
#framework_backtrace ⇒ Object
38 39 40 |
# File 'lib/active_support/core_ext/exception.rb', line 38 def framework_backtrace clean_backtrace.grep FrameworkRegexp end |