Created
June 11, 2009 04:54
-
-
Save smtlaissezfaire/127710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------- Exception#backtrace | |
exception.backtrace => array | |
From Ruby 1.8 | |
------------------------------------------------------------------------ | |
Returns any backtrace associated with the exception. The backtrace | |
is an array of strings, each containing either ``filename:lineNo: | |
in `method''' or ``filename:lineNo.'' | |
def a | |
raise "boom" | |
end | |
def b | |
a() | |
end | |
begin | |
b() | |
rescue => detail | |
print detail.backtrace.join("\n") | |
end | |
_produces:_ | |
prog.rb:2:in `a' | |
prog.rb:6:in `b' | |
prog.rb:10 | |
(END) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment