Files
base/pkg/locker/errors.go
2026-04-10 18:25:21 +03:30

22 lines
441 B
Go

package locker
import "fmt"
type LockErr struct {
id string
maxRetries uint32
err error
}
func NewLockError(id string, maxRetries uint32, acquireErr error) LockErr {
if acquireErr != nil {
return LockErr{id: id, maxRetries: maxRetries, err: acquireErr}
}
return LockErr{id, maxRetries, fmt.Errorf("failed to acquire lock after %d retries", maxRetries)}
}
func (l LockErr) Error() string {
return l.err.Error()
}