Exception: Exception

Defined in:
lib/qualitysmith_extensions/exception/inspect_with_backtrace.rb

Instance Method Summary collapse

Instance Method Details

#inspect_with_backtraceObject

Use this if you want to output an exception with all the details that you’d normally see if the exception went unrescued (since exception.inspect/p exception doesn’t provide a backtrace!)

This is mostly useful if you rescue an exception, want to print or log it and then re-raise it…

Use inspect_without_backtrace if you want to access the previous behavior (#<MissingSourceFile: no such file to load -- whatever>).



21
22
23
24
# File 'lib/qualitysmith_extensions/exception/inspect_with_backtrace.rb', line 21

def inspect_with_backtrace
  exception.class.name + ": " + exception.message + "\n" +
    exception.backtrace.map {|v| '  ' + v}.join( "\n" )
end