-
Notifications
You must be signed in to change notification settings - Fork 501
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 a new ConnectionError type for network errors #418
base: master
Are you sure you want to change the base?
Conversation
It has been useful for us to be able to test if returned errors are variations of "network connection gone", so we have added this change to our own code. Submitting it to upstream in case it is useful.
This looks like some kind of debugging improvement which probably should not change public interface. Maybe you should use logging to achieve the same goal? |
No, there is definitely a need for applications to automatically react to conditions like this. Unless you are suggesting we hook the logger up to the caller and the caller parses it ... |
I would argue the public interface is changed in a minor way? The only observable difference is which structs implements Error interface, but it looks the same from using Error? |
Once this change introduced it becomes something that cannot be changed in non backward-compatible way. Also there is a good chance that users would like to distinguish other kinds of errors, like in Python DBAPI there is a rich class hierarchy for database errors. You said you needed this functionality, can you provide details into your use-case? |
We simply want to retry the "outer" HTTP request into our backend automatically (without returning 503 and have the client do retry) for any kind of transient error. We use it in one place, which also classifies a number of other errors as transient errors. So I guess we could return net.Error or a TransientError or similar. Reporting only for writing and not for reading is probably a glitch / bug in this PR (unless those causes net.Error).
|
This seems to be a consequence of the driver not returning ErrBadConn. I don't think we should go deeper into a custom error implementation, getting the driver further away from the protocol it is suppose to implement. If we move to go 1.15, the Validator interface would allow this kind of special error handling though. |
It has been useful for us to be able to test if returned errors are
variations of "network connection gone", so we have added this change to
our own code. Submitting it to upstream in case it is useful.