-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use existing google_request_denied.txt
mock
#81
base: master
Are you sure you want to change the base?
Use existing google_request_denied.txt
mock
#81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give a little more detail on this change? What exactly is being accomplished here? The errors are not being suppressed, just wrapped in a Timezone::Error::GeoNames
exception.
OK, some example:
And the real case in this PR (from
This is not exception what we're waiting in this test-case: assert_raises Timezone::Error::Google, 'The provided API key is invalid.' do |
The rescue clause changes you have made do not resolve any underlying issues. When the |
It resolves:
I have not met anywhere else such wrapping of any error, I think it's bad practice. |
Now in our production env:
Execution of what expired? Not so clear. |
begin
@google_lookup.lookup(*args)
rescue Net::OpenTimeout
@geonames_lookup.lookup(*args)
end
If I'll rescue https://robots.thoughtbot.com/rescue-standarderror-not-exception Please! |
3dff10a
to
7f4626f
Compare
OK, in the last version of Branch is updated. |
The recommended way to manage network exceptions/cases beyond what is provided by default in this gem is to write your own http request handler: https://github.com/panthomakos/timezone#using-your-own-http-request-handler. I would be open to expanding the set of functionalities/APIs that the request handler manages. For example we could allow handlers to raise exceptions that don't get wrapped, or we could modify the internal client handling code so that some handlers can continue to raise exceptions. Another option would be to expand the timezone errors to also have a reference to A final, yet not mutually exclusive option, would be to create another subclass of errors that are network specific but that can be rescued in a backwards compatible manner as well. I want to think about the API in a little more detail before deciding on anything. In an ideal world, if there is going to be a backwards compatible change, I would probably want to re-design the http handlers so that they are responsible for providing a response body (or body and success/failure boolean) to the lookup object. That way the handlers could have their own set of exceptions/responses that they can raise/return independently of the lookup code. |
It's overhead for a simple exceptions catching.
I don't see a need for internal errors.
There is |
7f4626f
to
e3a46a7
Compare
Don't suppress any errors, please.
e3a46a7
to
0c3f702
Compare
Don't suppress any errors, please.