Skip to content

Instantly share code, notes, and snippets.

@smtlaissezfaire
Created June 11, 2009 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smtlaissezfaire/127710 to your computer and use it in GitHub Desktop.
Save smtlaissezfaire/127710 to your computer and use it in GitHub Desktop.
---------------------------------------------------- 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