Documentation
¶
Index ¶
- Variables
- func As[E error](err error) (e E, _ bool)
- func AsMatch[E error](err error) (match bool)
- func EmptyFieldError(field string) error
- func InvalidFieldError(field, reason string) error
- func New(s string) error
- func NewErrorf[E StringError](format string, args ...any) error
- type ErrCanceled
- type ErrInvalid
- type ErrNotFound
- type ErrUnauthenticated
- type ErrUnauthorized
- type ErrValidation
- type StringError
Constants ¶
This section is empty.
Variables ¶
var ErrCanceledf = NewErrorf[ErrCanceled]
ErrCanceledf is a convience function for producing ErrCanceled.
var ErrInvalidf = NewErrorf[ErrInvalid]
ErrInvalidf is a convience function for producing ErrInvalid.
var ErrNotFoundf = NewErrorf[ErrNotFound]
ErrNotFoundf is a convience function for producing ErrNotFound.
var ErrUnauthenticatedf = NewErrorf[ErrUnauthenticated]
ErrUnauthenticatedf is a convience function for producing ErrUnauthenticated.
Functions ¶
func As ¶
As is a utility for one-lining errors.As statements. e.g. cerr, match := errors.As[MyCustomError](err).
func AsMatch ¶
AsMatch is the same as As but it returns just a boolean to represent whether or not the wrapped type matches the type parameter.
func EmptyFieldError ¶
EmptyFieldError creates an ErrInvalidField for an empty field
func InvalidFieldError ¶
InvalidFieldError creates an ErrInvalidField for a specific field and reason
Types ¶
type ErrCanceled ¶
type ErrCanceled string
ErrCanceled is returned when an operation has been prematurely canceled by the requester.
func (ErrCanceled) Error ¶
func (e ErrCanceled) Error() string
type ErrInvalid ¶
type ErrInvalid string
ErrInvalid represents an invalid error
func (ErrInvalid) Error ¶
func (e ErrInvalid) Error() string
type ErrNotFound ¶
type ErrNotFound string
ErrNotFound represents a not found error
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type ErrUnauthenticated ¶
type ErrUnauthenticated string
ErrUnauthenticated is returned when an operation is attempted by an unauthenticated client in an authenticated context.
func (ErrUnauthenticated) Error ¶
func (e ErrUnauthenticated) Error() string
Error() returns the underlying string of the error.
type ErrUnauthorized ¶ added in v1.45.0
type ErrUnauthorized string
func (ErrUnauthorized) Error ¶ added in v1.45.0
func (e ErrUnauthorized) Error() string
type ErrValidation ¶
type ErrValidation struct {
// contains filtered or unexported fields
}
ErrValidation is a validation error for a specific field and reason
func (ErrValidation) Error ¶
func (e ErrValidation) Error() string
type StringError ¶
StringError is any error that also happens to have an underlying type of string.