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 | |
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 |