Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
retry: 增加闭包 Retry 方法,避免用户重复写类似的垃圾代码
Browse files Browse the repository at this point in the history
flycash committed Nov 2, 2024
1 parent 44dea05 commit 2403ff9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/errs/error.go
Original file line number Diff line number Diff line change
@@ -36,3 +36,7 @@ func NewErrInvalidIntervalValue(interval time.Duration) error {
func NewErrInvalidMaxIntervalValue(maxInterval, initialInterval time.Duration) error {
return fmt.Errorf("ekit: 最大重试间隔的时间 [%d] 应大于等于初始重试的间隔时间 [%d] ", maxInterval, initialInterval)
}

func NewErrRetryExhausted(lastErr error) error {
return fmt.Errorf("ekit: 超过最大重试次数,业务返回的最后一个 error %w", lastErr)
}

0 comments on commit 2403ff9

Please sign in to comment.