diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-04-04 19:37:29 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-04-04 19:37:29 +0000 |
commit | e714b25723b674bb6d66af40ea9047166907616b (patch) | |
tree | 757a0368a8cef19d5c951d68162ea73dabb6edaa /activesupport/lib/active_support/core_ext/exception.rb | |
parent | 62dc792a484e6e62fb2fb87fd47819144c5e3301 (diff) | |
download | rails-e714b25723b674bb6d66af40ea9047166907616b.tar.gz rails-e714b25723b674bb6d66af40ea9047166907616b.tar.bz2 rails-e714b25723b674bb6d66af40ea9047166907616b.zip |
Update the diagnostics template skip the useless '<controller not set>' text.
Fix symbol extensions test case.
Clean paths inside of exception messages and traces.
Add Pathname.clean_within for cleaning all the paths inside of a string.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/exception.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/exception.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/core_ext/exception.rb b/activesupport/lib/active_support/core_ext/exception.rb index 0b65af7bf8..2e3965117b 100644 --- a/activesupport/lib/active_support/core_ext/exception.rb +++ b/activesupport/lib/active_support/core_ext/exception.rb @@ -1,25 +1,30 @@ -class Exception - alias :clean_message :message +class Exception # :nodoc: + def clean_message + Pathname.clean_within message + end TraceSubstitutions = [] - FrameworkRegexp = /generated_code|vendor|dispatch|ruby|script\/\w+/ + FrameworkRegexp = /generated|vendor|dispatch|ruby|script\/\w+/ def clean_backtrace backtrace.collect do |line| - TraceSubstitutions.inject(line) do |line, (regexp, sub)| + Pathname.clean_within(TraceSubstitutions.inject(line) do |line, (regexp, sub)| line.gsub regexp, sub - end + end) end end def application_backtrace before_application_frame = true - clean_backtrace.reject do |line| - non_app_frame = !! (line =~ FrameworkRegexp) + 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 def framework_backtrace |