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 ¶
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 ¶
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.