Created
April 29, 2009 20:22
-
-
Save ecomba/104031 to your computer and use it in GitHub Desktop.
Raising an Exception and keeping the backtrace
This file contains hidden or 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
class A | |
def self.ouch | |
raise "blarrrghhh" | |
end | |
end | |
class B | |
def self.ouch | |
begin | |
A.ouch | |
rescue Exception => e | |
raise e, "#{e} I said!!!", e.backtrace | |
end | |
end | |
end | |
begin | |
B.ouch | |
rescue Exception => e | |
p e | |
p e.backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment