Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Forked from anonymous/ex.rb
Created June 18, 2015 22:43
Show Gist options
  • Save jordanorelli/468bc39552a4366f9de2 to your computer and use it in GitHub Desktop.
Save jordanorelli/468bc39552a4366f9de2 to your computer and use it in GitHub Desktop.
begin
response = call_api # this might throw X
response.save_to_db # this might throw Y
rescue X
# handle the error with calling the api
rescue Y
# handle the error with saving to the database
rescue Exception => e
# handles *any* exception; maybe you got the exception type wrong?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment