Guest User

Untitled

a guest
Jul 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. # Tested under:
  2. # $ ruby -v
  3. # ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02
  4.  
  5. class C
  6. def f
  7. raise NotImplementedError
  8. end
  9. end
  10.  
  11. begin
  12. result = C.new.f
  13. rescue => e
  14. if result.kind_of?( Exception ) then
  15. puts 'result is an Exception'
  16. else
  17. puts 'result was not an Exception'
  18. end
  19. end
  20.  
  21. # Output is:
  22. # NotImplementedError_bypasses_rescue_clause.rb: ... :in `f': NotImplementedError (NotImplementedError)
  23. # from NotImplementedError_bypasses_rescue_clause.rb: ...
Add Comment
Please, Sign In to add comment