Skip to content

Commit

Permalink
skip wrapping sql.ErrNoRows
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Dec 4, 2023
1 parent cdfc1f7 commit 14a2fd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions daos/base_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package daos

import (
"context"
"database/sql"
"errors"
"fmt"
"strings"
"time"
Expand All @@ -27,11 +29,11 @@ func execLockRetry(timeout time.Duration, maxRetries int) dbx.ExecHookFunc {
execErr := baseLockRetry(func(attempt int) error {
return op()
}, maxRetries)
if execErr != nil {
return fmt.Errorf("%w; failed query: %s", execErr, q.SQL())
if execErr != nil && !errors.Is(execErr, sql.ErrNoRows) {
execErr = fmt.Errorf("%w; failed query: %s", execErr, q.SQL())
}

return nil
return execErr
}
}

Expand Down

0 comments on commit 14a2fd6

Please sign in to comment.