Skip to content

Commit

Permalink
Merge pull request #598 from KubeKyrie/enhance-db-error
Browse files Browse the repository at this point in the history
make DB bad connection error message more specific
  • Loading branch information
Iceber authored Nov 23, 2023
2 parents 630cf19 + 035d5c9 commit 316fc57
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 316fc57

Please sign in to comment.