Browse files

Move backtrace filtering into its own method.

  • Loading branch information...
1 parent ec50915 commit 2b0df32eded4b8db6fbc72a58d32534c7e6fb788 @alloy committed Mar 14, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/mac_bacon.rb
View
7 lib/mac_bacon.rb
@@ -453,12 +453,15 @@ def error_message
end
end
+ def filtered_backtrace
+ $DEBUG ? @exception.backtrace : @exception.backtrace.find_all { |line| line !~ /bin\/macbacon|\/mac_bacon\.rb:\d+/ }
+ end
+
def error_log
if @exception
log = ''
log << "#{@exception.class}: #{@exception.message}\n"
- lines = $DEBUG ? @exception.backtrace : @exception.backtrace.find_all { |line| line !~ /bin\/macbacon|\/mac_bacon\.rb:\d+/ }
- lines.each_with_index { |line, i|
+ filtered_backtrace.each_with_index { |line, i|
log << "\t#{line}#{i==0 ? ": #{@context.class.name} - #{@description}" : ""}\n"
}
log

0 comments on commit 2b0df32

Please sign in to comment.