Documentation
¶
Index ¶
- Variables
- func IsPermanent(err error) bool
- func IsTransient(err error) bool
- func NewPermanent(err error) error
- func NewPermanentf(format string, args ...interface{}) error
- func NewTransient(err error) error
- func NewTransientf(format string, args ...interface{}) error
- type PermanentError
- type TransientError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTransient indicates a temporary error that should be retried ErrTransient = errors.New("transient error") // ErrPermanent indicates a permanent error that should not be retried ErrPermanent = errors.New("permanent error") // ErrNotFound indicates a resource was not found ErrNotFound = errors.New("not found") ErrUnauthorized = errors.New("unauthorized") // ErrForbidden indicates authorization failure ErrForbidden = errors.New("forbidden") // ErrInvalidInput indicates invalid input data ErrInvalidInput = errors.New("invalid input") // ErrTimeout indicates an operation timed out ErrTimeout = errors.New("timeout") // ErrRateLimit indicates rate limiting ErrRateLimit = errors.New("rate limit exceeded") )
Sentinel errors for common cases
Functions ¶
func IsPermanent ¶
IsPermanent checks if an error is permanent (not retryable)
func IsTransient ¶
IsTransient checks if an error is transient using errors.As
func NewPermanentf ¶
NewPermanentf creates a new permanent error with formatting
func NewTransientf ¶
NewTransientf creates a new transient error with formatting
Types ¶
type PermanentError ¶
type PermanentError struct {
Cause error
}
PermanentError wraps an error to mark it as permanent (not retryable)
func (*PermanentError) Error ¶
func (e *PermanentError) Error() string
func (*PermanentError) Unwrap ¶
func (e *PermanentError) Unwrap() error
type TransientError ¶
type TransientError struct {
Cause error
}
TransientError wraps an error to mark it as transient (retryable)
func (*TransientError) Error ¶
func (e *TransientError) Error() string
func (*TransientError) Unwrap ¶
func (e *TransientError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.