如何强制ruby显示完整的堆栈跟踪?

时间:2008-12-19 11:36:23

标签: ruby stack-trace

我刚收到此错误消息:

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

并且错误(当然)隐藏在... 10 levels...中的某个地方。

如何强制ruby显示完整的堆栈跟踪?

1 个答案:

答案 0 :(得分:74)

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