Ignoring API errors
This file contains 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
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