Skip to content

Commit

Permalink
make DB bad connection error messages more specific
Browse files Browse the repository at this point in the history
Signed-off-by: KubeKyrie <[email protected]>
  • Loading branch information
KubeKyrie committed Nov 23, 2023
1 parent 630cf19 commit 035d5c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/storage/internalstorage/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var recoverableErrors = []error{
io.ErrUnexpectedEOF,
os.ErrDeadlineExceeded,
syscall.ECONNREFUSED,
driver.ErrBadConn,
}

func init() {
Expand Down Expand Up @@ -65,6 +64,10 @@ func InterpretDBError(key string, err error) error {
return storage.NewRecoverableException(err)
}

if errors.Is(err, driver.ErrBadConn) {
return storage.NewRecoverableException(fmt.Errorf("storage error: database connection error: %s", err))
}

for _, re := range recoverableErrors {
if errors.Is(err, re) {
return storage.NewRecoverableException(err)
Expand Down

0 comments on commit 035d5c9

Please sign in to comment.