1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 01:05:35 -05:00

refactor error messages

This commit is contained in:
Darien Raymond
2017-04-09 01:43:25 +02:00
parent 8175a751db
commit 35248497d2
141 changed files with 710 additions and 481 deletions

View File

@@ -1,13 +1,13 @@
package retry
//go:generate go run $GOPATH/src/v2ray.com/core/tools/generrorgen/main.go -pkg retry -path Retry
import (
"time"
"v2ray.com/core/common/errors"
)
var (
ErrRetryFailed = errors.New("Retry: All retry attempts failed.")
ErrRetryFailed = newError("Retry: All retry attempts failed.")
)
// Strategy is a way to retry on a specific function.
@@ -38,7 +38,7 @@ func (r *retryer) On(method func() error) error {
<-time.After(time.Duration(delay) * time.Millisecond)
attempt++
}
return errors.New(accumulatedError).Base(ErrRetryFailed)
return newError(accumulatedError).Base(ErrRetryFailed)
}
// Timed returns a retry strategy with fixed interval.