errors

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsBadRequest

func AsBadRequest(err error, target **BadRequestError) bool

AsBadRequest attempts to cast the provided error to a BadRequestError. It returns true if the casting is successful, allowing the caller to handle it accordingly.

func AsRetryError

func AsRetryError(err error, target **RetryError) bool

func IsBadRequest

func IsBadRequest(err error) bool

IsBadRequest checks whether the provided error is of type BadRequestError. It returns true if the error is a BadRequestError or wraps a BadRequestError, false otherwise.

func IsRetryError

func IsRetryError(err error) bool

Types

type BadRequestError

type BadRequestError struct {
	Err error
}

BadRequestError represents a fatal error that requires special handling. Such errors are critical and may necessitate logging, alerts, or even program termination.

func NewBadRequestError

func NewBadRequestError(err error) *BadRequestError

NewBadRequestError creates a new instance of BadRequestError. It encapsulates the provided error, marking it as critical.

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

Error implements the error interface for BadRequestError. It returns the error message of the encapsulated error or a default message.

type RetryError

type RetryError struct {
	Err error
}

RetryError represents a benign error that can be handled or ignored by the caller. It encapsulates information that is non-critical and does not require immediate attention.

func NewRetryError

func NewRetryError(err error) *RetryError

NewRetryError creates a new instance of RetryError.

func (*RetryError) Error

func (e *RetryError) Error() string

Error implements the error interface for RetryError. It returns the error message of the encapsulated error or a default message.

Jump to

Keyboard shortcuts

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