Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2014 17:12
Show Gist options
  • Save anonymous/d67cb717321cf3a0eca7 to your computer and use it in GitHub Desktop.
Save anonymous/d67cb717321cf3a0eca7 to your computer and use it in GitHub Desktop.
Mutliple rescue/retry
class MyClass
begin
rescue API::AuthorizationError => e
api_authorize
retry
def api_authorize
#do login things here, set a global containing a session
end
def initialize
api_authorize
end
def do_things_with_api
#stuff
end
end
end
##Burning question: will the "rescue" block with a 'retry' set cause do_things_with_api to re-execute?
#Or do I need to add this handler inside do_things_with_api?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment