Created
August 20, 2016 02:14
-
-
Save jeremy/712a01d40cc9fa3765ee330d2b050777 to your computer and use it in GitHub Desktop.
Reraising an exception never amends its 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
def foo | |
e = RuntimeError.new | |
def e.backtrace() %w[ lol rofl ] end | |
raise e | |
rescue => e | |
raise e | |
end | |
foo | |
# Same result on 1.8, 1.9, 2.3, 2.4: | |
# lol: RuntimeError (RuntimeError) | |
# from rofl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment