Documentation ¶
Overview ¶
Package fserrors provides errors and error handling
Index ¶
- func Cause(cause error) (retriable bool, err error)
- func ContextError(ctx context.Context, perr *error) bool
- func Count(err error)
- func FatalError(err error) error
- func FsError(err error) error
- func IsCounted(err error) bool
- func IsErrNoSpace(cause error) (isNoSpc bool)
- func IsFatalError(err error) (isFatal bool)
- func IsNoLowLevelRetryError(err error) (isNoLowLevelRetry bool)
- func IsNoRetryError(err error) (isNoRetry bool)
- func IsRetryAfterError(err error) bool
- func IsRetryError(err error) (isRetry bool)
- func NoLowLevelRetryError(err error) error
- func NoRetryError(err error) error
- func RetryAfterErrorTime(err error) (retryAfter time.Time)
- func RetryError(err error) error
- func RetryErrorf(format string, a ...interface{}) error
- func ShouldRetry(err error) bool
- func ShouldRetryHTTP(resp *http.Response, retryErrorCodes []int) bool
- type CountableError
- type ErrorRetryAfter
- type Fataler
- type NoLowLevelRetrier
- type NoRetrier
- type Retrier
- type RetryAfter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cause ¶
Cause is a souped up errors.Cause which can unwrap some standard library errors too. It returns true if any of the intermediate errors had a Timeout() or Temporary() method which returned true.
func ContextError ¶ added in v1.55.0
ContextError checks to see if ctx is in error.
If it is in error then it overwrites *perr with the context error if *perr was nil and returns true.
Otherwise it returns false.
func Count ¶ added in v1.50.4
func Count(err error)
Count sets the isCounted variable on the error if it conforms to the CountableError interface
func FatalError ¶
FatalError makes an error which indicates it is a fatal error and the sync should stop.
func FsError ¶ added in v1.50.4
FsError makes an error which can keep a record that it is already counted or not
func IsCounted ¶ added in v1.50.4
IsCounted returns true if err conforms to the CountableError interface and has already been counted
func IsErrNoSpace ¶ added in v1.55.0
IsErrNoSpace checks a possibly wrapped error to see if it contains a ENOSPC error
func IsFatalError ¶
IsFatalError returns true if err conforms to the Fatal interface and calling the Fatal method returns true.
func IsNoLowLevelRetryError ¶ added in v1.50.4
IsNoLowLevelRetryError returns true if err conforms to the NoLowLevelRetry interface and calling the NoLowLevelRetry method returns true.
func IsNoRetryError ¶
IsNoRetryError returns true if err conforms to the NoRetry interface and calling the NoRetry method returns true.
func IsRetryAfterError ¶
IsRetryAfterError returns true if err is an ErrorRetryAfter
func IsRetryError ¶
IsRetryError returns true if err conforms to the Retry interface and calling the Retry method returns true.
func NoLowLevelRetryError ¶ added in v1.50.4
NoLowLevelRetryError makes an error which indicates the sync shouldn't be low level retried.
func NoRetryError ¶
NoRetryError makes an error which indicates the sync shouldn't be retried.
func RetryAfterErrorTime ¶
RetryAfterErrorTime returns the time that the RetryAfter error indicates or a Zero time.Time
func RetryError ¶
RetryError makes an error which indicates it would like to be retried
func RetryErrorf ¶
RetryErrorf makes an error which indicates it would like to be retried
func ShouldRetry ¶
ShouldRetry looks at an error and tries to work out if retrying the operation that caused it would be a good idea. It returns true if the error implements Timeout() or Temporary() or if the error indicates a premature closing of the connection.
Types ¶
type CountableError ¶ added in v1.50.4
CountableError is an optional interface for error. It stores a boolean which signifies if the error has already been counted or not
type ErrorRetryAfter ¶
ErrorRetryAfter is an error which expresses a time that should be waited for until trying again
func NewErrorRetryAfter ¶
func NewErrorRetryAfter(d time.Duration) ErrorRetryAfter
NewErrorRetryAfter returns an ErrorRetryAfter with the given duration as an endpoint
func (ErrorRetryAfter) Error ¶
func (e ErrorRetryAfter) Error() string
Error returns the textual version of the error
func (ErrorRetryAfter) RetryAfter ¶
func (e ErrorRetryAfter) RetryAfter() time.Time
RetryAfter returns the time the operation should be retried at or after
type Fataler ¶
Fataler is an optional interface for error as to whether the operation should cause the entire operation to finish immediately.
This should be returned from Update or Put methods as required
type NoLowLevelRetrier ¶ added in v1.50.4
NoLowLevelRetrier is an optional interface for error as to whether the operation should not be retried at a low level.
NoLowLevelRetry errors won't be retried by low level retry loops.
type NoRetrier ¶
NoRetrier is an optional interface for error as to whether the operation should not be retried at a high level.
If only NoRetry errors are returned in a sync then the sync won't be retried.
This should be returned from Update or Put methods as required
type Retrier ¶
Retrier is an optional interface for error as to whether the operation should be retried at a high level.
This should be returned from Update or Put methods as required
type RetryAfter ¶
RetryAfter is an optional interface for error as to whether the operation should be retried after a given delay
This should be returned from Update or Put methods as required and will cause the entire sync to be retried after a delay.