Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save softcraft-development/8ef051d7340954e5acfc3e26103af4ac to your computer and use it in GitHub Desktop.
Save softcraft-development/8ef051d7340954e5acfc3e26103af4ac to your computer and use it in GitHub Desktop.
begin
begin
raise Exception.new("An Exception")
rescue => e
puts "Rescued an unspecified error: #{e.message}"
end
rescue Exception => e
puts "Rescued an exception: #{e.message}"
end
# Displays "Rescued an exception: An Exception"
begin
begin
raise StandardError.new("A nonstandard Error")
rescue => e
puts "Rescued an unspecified error: #{e.message}"
end
rescue Exception => e
puts "Rescued an exception: #{e.message}"
end
# Displays "Rescued an unspecified error: A nonstandard Error"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment