From f42c77f927eb49b00e84d355e07de48723d03fcb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 22 Nov 2008 18:06:08 +0100 Subject: Added ActiveSupport::BacktraceCleaner and Rails::BacktraceCleaner for cutting down on backtrace noise (inspired by the Thoughtbot Quiet Backtrace plugin) [DHH] --- actionpack/lib/action_controller/rescue.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'actionpack/lib/action_controller/rescue.rb') diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb index ec8e9b92d5..9c24c3def4 100644 --- a/actionpack/lib/action_controller/rescue.rb +++ b/actionpack/lib/action_controller/rescue.rb @@ -68,9 +68,8 @@ module ActionController #:nodoc: logger.fatal(exception.to_s) else logger.fatal( - "\n\n#{exception.class} (#{exception.message}):\n " + - clean_backtrace(exception).join("\n ") + - "\n\n" + "\n#{exception.class} (#{exception.message}):\n " + + clean_backtrace(exception).join("\n ") + "\n\n" ) end end @@ -151,13 +150,8 @@ module ActionController #:nodoc: end def clean_backtrace(exception) - if backtrace = exception.backtrace - if defined?(RAILS_ROOT) - backtrace.map { |line| line.sub RAILS_ROOT, '' } - else - backtrace - end - end + defined?(Rails) && Rails.respond_to?(:backtrace_cleaner) ? + Rails.backtrace_cleaner.clean(exception.backtrace) : exception.backtrace end end end -- cgit v1.2.3