Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HotFusionMan/745669 to your computer and use it in GitHub Desktop.
Save HotFusionMan/745669 to your computer and use it in GitHub Desktop.
NotImplementedError bypasses rescue clause in Ruby 1.8.7 (REE)
# 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