Guest User

Untitled

a guest
May 28th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. begin
  2. begin
  3. raise Exception.new("An Exception")
  4. rescue => e
  5. puts "Rescued an unspecified error: #{e.message}"
  6. end
  7. rescue Exception => e
  8. puts "Rescued an exception: #{e.message}"
  9. end
  10.  
  11. # Displays "Rescued an exception: An Exception"
  12.  
  13. begin
  14. begin
  15. raise StandardError.new("A nonstandard Error")
  16. rescue => e
  17. puts "Rescued an unspecified error: #{e.message}"
  18. end
  19. rescue Exception => e
  20. puts "Rescued an exception: #{e.message}"
  21. end
  22.  
  23. # Displays "Rescued an unspecified error: A nonstandard Error"
Add Comment
Please, Sign In to add comment