Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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: ...
Add Comment
Please, Sign In to add comment