fserrors

package
v1.48.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package fserrors provides errors and error handling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(cause error) (retriable bool, err error)

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 FatalError

func FatalError(err error) error

FatalError makes an error which indicates it is a fatal error and the sync should stop.

func IsFatalError

func IsFatalError(err error) (isFatal bool)

IsFatalError returns true if err conforms to the Fatal interface and calling the Fatal method returns true.

func IsNoRetryError

func IsNoRetryError(err error) (isNoRetry bool)

IsNoRetryError returns true if err conforms to the NoRetry interface and calling the NoRetry method returns true.

func IsRetryAfterError added in v1.47.0

func IsRetryAfterError(err error) bool

IsRetryAfterError returns true if err is an ErrorRetryAfter

func IsRetryError

func IsRetryError(err error) (isRetry bool)

IsRetryError returns true if err conforms to the Retry interface and calling the Retry method returns true.

func NoRetryError

func NoRetryError(err error) error

NoRetryError makes an error which indicates the sync shouldn't be retried.

func RetryAfterErrorTime added in v1.47.0

func RetryAfterErrorTime(err error) (retryAfter time.Time)

RetryAfterErrorTime returns the time that the RetryAfter error indicates or a Zero time.Time

func RetryError

func RetryError(err error) error

RetryError makes an error which indicates it would like to be retried

func RetryErrorf

func RetryErrorf(format string, a ...interface{}) error

RetryErrorf makes an error which indicates it would like to be retried

func ShouldRetry

func ShouldRetry(err error) bool

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.

func ShouldRetryHTTP

func ShouldRetryHTTP(resp *http.Response, retryErrorCodes []int) bool

ShouldRetryHTTP returns a boolean as to whether this resp deserves. It checks to see if the HTTP response code is in the slice retryErrorCodes.

Types

type ErrorRetryAfter added in v1.47.0

type ErrorRetryAfter time.Time

ErrorRetryAfter is an error which expresses a time that should be waited for until trying again

func NewErrorRetryAfter added in v1.47.0

func NewErrorRetryAfter(d time.Duration) ErrorRetryAfter

NewErrorRetryAfter returns an ErrorRetryAfter with the given duration as an endpoint

func (ErrorRetryAfter) Error added in v1.47.0

func (e ErrorRetryAfter) Error() string

Error returns the textual version of the error

func (ErrorRetryAfter) RetryAfter added in v1.47.0

func (e ErrorRetryAfter) RetryAfter() time.Time

RetryAfter returns the time the operation should be retried at or after

type Fataler

type Fataler interface {
	error
	Fatal() bool
}

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 NoRetrier

type NoRetrier interface {
	error
	NoRetry() bool
}

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

type Retrier interface {
	error
	Retry() bool
}

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 added in v1.47.0

type RetryAfter interface {
	error
	RetryAfter() time.Time
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL