Skip to content

Use communicationError for network errors #219

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

Closed
wants to merge 1 commit into from
Closed

Use communicationError for network errors #219

wants to merge 1 commit into from

Conversation

johto
Copy link
Contributor

@johto johto commented Jan 1, 2014

This seems cleaner than trying to maintain the list of errors which might have originated from operations on the network socket / TLS layer.

Any thoughts?

This is cleaner and less error-prone than comparing strings.
@johto
Copy link
Contributor Author

johto commented Jan 1, 2014

Though this does change the behaviour a bit. The way we currently deal with network errors only turns a known list of errors into ErrBadConn, which would give the user more information if e.g. the TCPConn returns an error because something's badly wrong.

I wish there was a way to say "this connection is bad", but also specify an error to be returned to the user if database/sql is going to give up on retrying. The way things currently work inside database/sql is pretty ugly.

@tamird
Copy link
Collaborator

tamird commented Feb 8, 2016

This seems wrong based on discussion in #422. This change will cause all network errors to bubble up as driver.ErrBadConn, despite the fact that some work may have been done on the server.

@johto
Copy link
Contributor Author

johto commented Feb 8, 2016

This seems wrong based on discussion in #422. This change will cause all network errors to bubble up as driver.ErrBadConn, despite the fact that some work may have been done on the server.

That's already what happens. This PR tried to keep the same semantics but without the ugly string comparisons (which, I'm guessing, could fail at any point).

@johto
Copy link
Contributor Author

johto commented Feb 8, 2016

I wrote:

I wish there was a way to say "this connection is bad", but also specify an error to be returned to the user if database/sql is going to give up on retrying. The way things currently work inside database/sql is pretty ugly.

Now we actually have the necessary pieces to do this.

@johto johto closed this Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants