Created
October 11, 2012 01:58
-
-
Save banyan/3869700 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
def bar | |
raise NoMemoryError | |
rescue puts "hi" | |
end | |
bar # Exception は補足できない | |
# /Users/kohei/lang/ruby/exception.rb:3:in `foo': NoMemoryError (NoMemoryError) | |
# from /Users/kohei/lang/ruby/exception.rb:8:in `<main>' | |
def foo | |
raise StandardError | |
rescue | |
puts "hi" | |
end | |
foo # => hi が出力される、補足できるのは StandardError とそのサブクラスのみ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment