skip wrapping sql.ErrNoRows

This commit is contained in:
Gani Georgiev 2023-12-04 16:23:56 +02:00
parent cdfc1f7b70
commit 14a2fd6215
1 changed files with 5 additions and 3 deletions

View File

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