Skip to content

Instantly share code, notes, and snippets.

@bradhe
Created September 21, 2012 21:09
Show Gist options
  • Select an option

  • Save bradhe/3763912 to your computer and use it in GitHub Desktop.

Select an option

Save bradhe/3763912 to your computer and use it in GitHub Desktop.
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
@bradhe
Copy link
Author

bradhe commented Sep 21, 2012

$ ruby /tmp/gpg/test.rb
RuntimeError: Hello, World!
ArgumentError: Hello, World!
RuntimeError: Hello, World!
TypeError: exception class/object expected
TypeError: exception class/object expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment