Ruby – How to force Ruby to show a full stack trace?

rubystack-trace

I just got this error message:

...
from c:/ruby/lib/ruby/gems/1.8/gems/...
 ... 10 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/...
...

and the bug (of course) is hidden somewhere in ... 10 levels....

How can I force Ruby to show a full stack trace?

Best Solution

begin
  # Code that raises exception
rescue StandardError => e
  puts e.backtrace
end