Skip to content

Instantly share code, notes, and snippets.

@etiennebarrie
Created September 15, 2011 09:47
Show Gist options
  • Save etiennebarrie/1218915 to your computer and use it in GitHub Desktop.
Save etiennebarrie/1218915 to your computer and use it in GitHub Desktop.
Wrong = Class.new(Exception)
Right = Class.new(StandardError)
begin
raise Wrong, "Can't be rescued easily"
rescue
puts "Not reached"
rescue Wrong
puts "#{$!}, have to be explicitely rescued"
end
begin
raise Right, "Much cooler"
rescue
puts "#{$!}, easily rescued"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment