errors

package
v0.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As wraps errors.As

func Is

func Is(err, target error) bool

Is wraps errors.Is

func IsBadRequest

func IsBadRequest(err error) bool

func IsForbidden

func IsForbidden(err error) bool

func IsInternalServerError

func IsInternalServerError(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsRequestError

func IsRequestError(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

func New

func New(message string) error

New wraps errors.New

func Unwrap

func Unwrap(err error) error

Unwrap wraps errors.Unwrap

Types

type BadRequest

type BadRequest struct {
	Message string `json:"message"`
}

BadRequest represents a 400 error.

func NewBadRequest

func NewBadRequest(message string, args ...any) *BadRequest

func (*BadRequest) Error

func (b *BadRequest) Error() string

type Forbidden

type Forbidden struct {
	Message string `json:"message"`
}

Forbidden represents a 403 error.

func NewForbidden

func NewForbidden(message string, args ...any) *Forbidden

func (*Forbidden) Error

func (f *Forbidden) Error() string

type InternalServerError

type InternalServerError struct {
	Message string `json:"message"`
}

InternalServerError represents a 500 error.

func NewInternalServerError

func NewInternalServerError(message string, args ...any) *InternalServerError

func (*InternalServerError) Error

func (i *InternalServerError) Error() string

type NotFound

type NotFound struct {
	Message string `json:"message"`
}

NotFound represents a 404 error.

func NewNotFound

func NewNotFound(message string, args ...any) *NotFound

func (*NotFound) Error

func (n *NotFound) Error() string

type RequestError

type RequestError struct {
	// contains filtered or unexported fields
}

func NewRequestError

func NewRequestError(err error) *RequestError

func NewRequestErrorf

func NewRequestErrorf(format string, args ...any) *RequestError

func (*RequestError) Error

func (r *RequestError) Error() string

func (*RequestError) RawURL

func (r *RequestError) RawURL() string

func (*RequestError) StatusCode

func (r *RequestError) StatusCode() int

func (*RequestError) Unwrap

func (r *RequestError) Unwrap() error

func (*RequestError) WithRawURL

func (r *RequestError) WithRawURL(rawURL string) *RequestError

func (*RequestError) WithStatusCode

func (r *RequestError) WithStatusCode(statusCode int) *RequestError

type Unauthorized

type Unauthorized struct {
	Message string `json:"message"`
}

Unauthorized represents a 401 error.

func NewUnauthorized

func NewUnauthorized(message string, args ...any) *Unauthorized

func (*Unauthorized) Error

func (u *Unauthorized) Error() string

Jump to

Keyboard shortcuts

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