Make a retry error wrapper for a plain error
This commit is contained in:
parent
fec16b0ac8
commit
a288c2b3a3
1 changed files with 18 additions and 0 deletions
18
fs/fs.go
18
fs/fs.go
|
@ -222,6 +222,24 @@ func RetryErrorf(format string, a ...interface{}) error {
|
||||||
return retryError(fmt.Sprintf(format, a...))
|
return retryError(fmt.Sprintf(format, a...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PlainRetryError is an error wrapped so it will retry
|
||||||
|
type plainRetryError struct {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retry interface
|
||||||
|
func (_ plainRetryError) Retry() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check interface
|
||||||
|
var _ Retry = plainRetryError{(error)(nil)}
|
||||||
|
|
||||||
|
// RetryError makes an error which indicates it would like to be retried
|
||||||
|
func RetryError(err error) error {
|
||||||
|
return plainRetryError{err}
|
||||||
|
}
|
||||||
|
|
||||||
// A channel of Objects
|
// A channel of Objects
|
||||||
type ObjectsChan chan Object
|
type ObjectsChan chan Object
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue