Outputting errors in a rescue (Ruby/Rails)
There are at least two ways that I know of to get the error. The first is using a global variable: $! which is always set to the last error that occurred. The second is by explicitly capturing the error when you rescue:
begin # do something that fails...rescue => error # error and $! are equivalent hereend
Either one will let you inspect or print out the backtrace using either:
$!.backtrace # => array of backtrace stepserror.backtrace # => same error