Created
December 17, 2010 20:41
-
-
Save HotFusionMan/745669 to your computer and use it in GitHub Desktop.
NotImplementedError bypasses rescue clause in Ruby 1.8.7 (REE)
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
# Tested under: | |
# $ ruby -v | |
# ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02 | |
class C | |
def f | |
raise NotImplementedError | |
end | |
end | |
begin | |
result = C.new.f | |
rescue => e | |
if result.kind_of?( Exception ) then | |
puts 'result is an Exception' | |
else | |
puts 'result was not an Exception' | |
end | |
end | |
# Output is: | |
# NotImplementedError_bypasses_rescue_clause.rb: ... :in `f': NotImplementedError (NotImplementedError) | |
# from NotImplementedError_bypasses_rescue_clause.rb: ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment