Created
June 21, 2011 01:30
-
-
Save ronny/1037040 to your computer and use it in GitHub Desktop.
`rescue => e` defaults to StandardError and its descendants
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
begin | |
raise NotImplementedError, "this will not be rescued" | |
puts "this will never be printed" | |
rescue => e | |
puts "A #{e.inspect} has been rescued." | |
end | |
# Would result in: | |
# in `<main>': this will not be rescued (NotImplementedError) | |
# See also: http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment