Skip to content

Instantly share code, notes, and snippets.

@ecomba
Created April 29, 2009 20:22
Show Gist options
  • Save ecomba/104031 to your computer and use it in GitHub Desktop.
Save ecomba/104031 to your computer and use it in GitHub Desktop.
Raising an Exception and keeping the backtrace
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