diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2005-10-15 19:03:38 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2005-10-15 19:03:38 +0000 |
commit | 49ec08aaa76c4d1e5ea3286fa56e4afa927bf135 (patch) | |
tree | 773a440e5cd0cc3f0715f4437b7d4992faf07c6a | |
parent | 3b8fce7b52819a8ccbad657a776854ab74b708e8 (diff) | |
download | rails-49ec08aaa76c4d1e5ea3286fa56e4afa927bf135.tar.gz rails-49ec08aaa76c4d1e5ea3286fa56e4afa927bf135.tar.bz2 rails-49ec08aaa76c4d1e5ea3286fa56e4afa927bf135.zip |
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
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/exception.rb | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index e6709f0d3e..40ea411ada 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added Extension extension to provide support for clean backtraces. [Nicholas Seckar] + * Updated whiny nil to be more concise and useful. [Nicholas Seckar] * Added Enumerable#first_match [Nicholas Seckar] 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 |