Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only write out the backtrace if we died from an Exception.

  • Loading branch information...
commit 7ae78ccbfdbf7e9897271ef01e8b43eac43d0fe1 1 parent d55fb5f
@marcbowes marcbowes authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/safely/backtrace.rb
View
3  lib/safely/backtrace.rb
@@ -16,6 +16,7 @@ def safe_shutdown!
def log_exceptions
return unless @enabled && self.trace_directory && File.directory?( self.trace_directory )
+ return if (last_exception = $!).nil?
require 'logger'
@@ -24,7 +25,7 @@ def log_exceptions
# Log the last exception
trace_log.info "*** Below you'll find the most recent exception thrown, this will likely (but not certainly) be the exception that made #{DaemonKit.configuration.daemon_name} exit abnormally ***"
- trace_log.error $!
+ trace_log.error last_exception
trace_log.info "*** Below you'll find all the exception objects in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***"
ObjectSpace.each_object {|o|
Please sign in to comment.
Something went wrong with that request. Please try again.