errors

package
v0.0.0-...-3a7d5fb Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFatal

func IsFatal(err error) bool

IsFatal can detect whether a wrappedError is Fatal or not. This method does not work on a regular error and will assume all regular error instances are not fatal

func IsRetryable

func IsRetryable(err error) bool

IsRetryable can detect whether a wrappedError is Retryable or not. This method does not work on a regular error and will assume all regular error instances are not retryable

Types

type FatalServerError

type FatalServerError interface {
	IsFatal() bool
	// contains filtered or unexported methods
}

FatalServerError is a special error interface which is understood by client/pool for the purposes of indicating the error should conditionally trigger a non-recoverable failure for that request, which is indicated by IsFatal returning true.

func MakeFatal

func MakeFatal(err error) FatalServerError

MakeFatal wraps an existing error into a FatalServerError. MakeFatal is composable with other wrappedError types.

func NewFatalError

func NewFatalError(errReason string) FatalServerError

NewFatalError is a helper that produces a FatalServerError

func NewFatalErrorf

func NewFatalErrorf(format string, args ...interface{}) FatalServerError

NewFatalErrorf is a helper that produces a FatalServerError

type FatalServerErrorInstance

type FatalServerErrorInstance struct {
	// contains filtered or unexported fields
}

FatalServerErrorInstance is a simple type which implements FatalServerError interface. This pattern can be extended to create other complex error types which can also conditionally respond as non-recoverable.

func (FatalServerErrorInstance) Error

func (e FatalServerErrorInstance) Error() string

Error returns the error message

func (FatalServerErrorInstance) IsFatal

func (e FatalServerErrorInstance) IsFatal() bool

IsFatal indicates whether the error should be considered non-recoverable for that request

type RetryableErrorInstance

type RetryableErrorInstance struct {
	// contains filtered or unexported fields
}

RetryableErrorInstance is a simple type which implements the RetryableServerError interface. This pattern can be extended to create other complex error types which can also conditionally respond as retryable.

func (RetryableErrorInstance) Error

func (e RetryableErrorInstance) Error() string

Error returns the error message

func (RetryableErrorInstance) IsRetryable

func (e RetryableErrorInstance) IsRetryable() bool

IsRetryable indicates whether the error should be attempted again

type RetryableServerError

type RetryableServerError interface {
	IsRetryable() bool
	// contains filtered or unexported methods
}

RetryableServerError is a special error interface which is understood by client/pool for the purposes of indicating whether the error should conditionally retry the request, which is indicated by IsRetryable returning true.

func MakeRetryable

func MakeRetryable(err error) RetryableServerError

MakeRetryable wraps an existing error into a RetryableServerError. This method can be used to wrap other already wrappedError types.

func NewRetryableError

func NewRetryableError(errReason string) RetryableServerError

NewRetryableError is a helper that produces a RetryableServerError

func NewRetryableErrorf

func NewRetryableErrorf(format string, args ...interface{}) RetryableServerError

NewRetryableErrorf is a helper that produces a RetryableServerError

Jump to

Keyboard shortcuts

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