From 49ec08aaa76c4d1e5ea3286fa56e4afa927bf135 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Sat, 15 Oct 2005 19:03:38 +0000 Subject: Added Extension extension to provide support for clean backtraces. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2623 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/exception.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 activesupport/lib/active_support/core_ext/exception.rb (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/exception.rb b/activesupport/lib/active_support/core_ext/exception.rb new file mode 100644 index 0000000000..323d97aa44 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/exception.rb @@ -0,0 +1,18 @@ +class Exception + + alias :clean_message :message + + TraceSubstitutions = [] + + def clean_backtrace + backtrace.collect do |line| + TraceSubstitutions.inject(line) do |line, (regexp, sub)| + line.gsub regexp, sub + end + end + end + + def application_backtrace + clean_backtrace.reject { |line| line =~ /(vendor|dispatch|ruby|script\/\w+)/ } + end +end \ No newline at end of file -- cgit v1.2.3