Created
December 3, 2009 16:28
-
-
Save ascruggs/248304 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
# 1. explicitly assign the exception to a variable | |
begin | |
raise "boom" | |
rescue StandardError => e | |
puts e.message | |
end | |
# 2. use the global variable | |
begin | |
raise "boom" | |
rescue StandardError | |
puts $!.message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment