Skip to content

Instantly share code, notes, and snippets.

@amiel
Created February 21, 2014 01:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amiel/9127033 to your computer and use it in GitHub Desktop.
Ignoring API errors
class APIClient
def get_teapots
ignore_errors do
make_request :teapots
end
end
def get_coffeepots
ignore_errors do
make_request :coffeepots
end
end
private
def ignore_errors
yield
rescue *STUPID_ERRORS => e
# generic error handling
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment