Skip to content

Commit

Permalink
fix scrutinizer recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Oct 6, 2018
1 parent 21779a3 commit 306fb9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Retry(deadline <-chan struct{}, action Action, strategies ...strategy.Strat
select {
case <-deadline:
atomic.CompareAndSwapUint32(&interrupt, 0, 1)
return timeoutErr
return errTimeout
case <-done:
return err
}
Expand All @@ -65,7 +65,7 @@ func IsRecovered(err error) (interface{}, bool) {

// IsTimeout checks that the error is related to the incident deadline on Retry call.
func IsTimeout(err error) bool {
return err == timeoutErr
return err == errTimeout
}

type panicHandler struct {
Expand All @@ -75,13 +75,13 @@ type panicHandler struct {

func (panicHandler) recover(err *error) {
if r := recover(); r != nil {
*err = panicHandler{panicErr, r}
*err = panicHandler{errPanic, r}
}
}

var (
panicErr = errors.New("unhandled action's panic")
timeoutErr = errors.New("operation timeout")
errPanic = errors.New("unhandled action's panic")
errTimeout = errors.New("operation timeout")
)

// shouldAttempt evaluates the provided strategies with the given attempt to
Expand Down

0 comments on commit 306fb9f

Please sign in to comment.