errors

package
v0.0.0-...-70e16f3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package errors contains internal types for the retry set of packages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRetryCanceled is an error that is returned when a retry is canceled. This is substituted for a context.Canceled
	// or context.DeadlineExceeded error to differentiate between a retry being cancelled and the last error from the Op being
	// context.Canceled or context.DeadlineExceeded.
	ErrRetryCanceled = errors.New("retry canceled")

	// ErrPermanent is an error that is permanent and cannot be retried. This
	// is similar to errors.ErrUnsupported in that it shouldn't be used directly, but instead
	// wrapped in another error. You can determine if you have a permanent error with
	// Is(err, ErrPermanent).
	ErrPermanent = errors.New("permanent error")
)

Functions

func As

func As(err error, target interface{}) bool

As is a wrapper for errors.As.

func Is

func Is(err error, target error) bool

Is is a wrapper for errors.Is.

Types

type ErrRetryAfter

type ErrRetryAfter struct {
	// Time after which the call can be retried.
	Time time.Time
	// The error that can be retried.
	Err error
}

ErrRetryAfter can be used to wrap an error to indicate that the error can be retried after a certain time. This is useful when a remote service returns a retry interval in the response and you want to carry the signal to your retry logic. This error should not be returned to the caller of Retry(). DO NOT use this as &ErrRetryAfter{}, simply ErrRetryAfter{} or it won't work.'

func (ErrRetryAfter) Error

func (e ErrRetryAfter) Error() string

Error implements error.Error().

func (ErrRetryAfter) Unwrap

func (e ErrRetryAfter) Unwrap() error

Unwrap unwraps the error.

Jump to

Keyboard shortcuts

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