]> Cypherpunks repositories - gostls13.git/commit
database/sql: use errors.Is when checking ErrBadConn
authorDaniel Theophanes <kardianos@gmail.com>
Mon, 12 Jul 2021 14:25:04 +0000 (09:25 -0500)
committerDaniel Theophanes <kardianos@gmail.com>
Wed, 3 Nov 2021 22:51:09 +0000 (22:51 +0000)
commit1f368d5b860b178bcbd55dfeb64474295263516b
tree15044e9c6db0af964a6d08bdd3bf50dec975754d
parentd3f5dd57811ca6c55654e67c58cf594fc2e5091e
database/sql: use errors.Is when checking ErrBadConn

When drivers return driver.ErrBadConn, no meaningful
information about what the cause of the problem is
returned. Ideally the driver.ErrBadConn would be
always caught with the retry loop, but this is not
always the case. Drivers today must choose between
returning a useful error and use the rety logic.
This allows supporting both.

Fixes #47142

Change-Id: I454573028f041dfdf874eed6c254fb194ccf6d96
Reviewed-on: https://go-review.googlesource.com/c/go/+/333949
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/database/sql/driver/driver.go
src/database/sql/fakedb_test.go
src/database/sql/sql.go
src/database/sql/sql_test.go