Created
September 21, 2012 21:09
-
-
Save bradhe/3763912 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| begin | |
| raise "Hello, World!" | |
| rescue => e | |
| puts "#{e.class.name}: #{e}" | |
| end | |
| begin | |
| raise ArgumentError, "Hello, World!" | |
| rescue => e | |
| puts "#{e.class.name}: #{e}" | |
| end | |
| begin | |
| raise "Hello, World!" | |
| rescue StandardError => e | |
| puts "#{e.class.name}: #{e}" | |
| end | |
| begin | |
| raise ["Hello, World!"] | |
| rescue StandardError => e | |
| puts "#{e.class.name}: #{e}" | |
| end | |
| begin | |
| raise Object.new, "Hi" | |
| rescue StandardError => e | |
| puts "#{e.class.name}: #{e}" | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ ruby /tmp/gpg/test.rb
RuntimeError: Hello, World!
ArgumentError: Hello, World!
RuntimeError: Hello, World!
TypeError: exception class/object expected
TypeError: exception class/object expected