errors

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequest                   = &Error{} //nolint
	Unauthorized                 = &Error{} //nolint
	PaymentRequired              = &Error{} //nolint
	Forbidden                    = &Error{} //nolint
	NotFound                     = &Error{} //nolint
	MethodNotAllowed             = &Error{} //nolint
	NotAcceptable                = &Error{} //nolint
	ProxyAuthRequired            = &Error{} //nolint
	RequestTimeout               = &Error{} //nolint
	Conflict                     = &Error{} //nolint
	Gone                         = &Error{} //nolint
	LengthRequired               = &Error{} //nolint
	PreconditionFailed           = &Error{} //nolint
	RequestEntityTooLarge        = &Error{} //nolint
	RequestURITooLong            = &Error{} //nolint
	UnsupportedMediaType         = &Error{} //nolint
	RequestedRangeNotSatisfiable = &Error{} //nolint
	ExpectationFailed            = &Error{} //nolint
	Teapot                       = &Error{} //nolint
	MisdirectedRequest           = &Error{} //nolint
	UnprocessableEntity          = &Error{} //nolint
	Locked                       = &Error{} //nolint
	FailedDependency             = &Error{} //nolint
	TooEarly                     = &Error{} //nolint
	UpgradeRequired              = &Error{} //nolint
	PreconditionRequired         = &Error{} //nolint
	TooManyRequests              = &Error{} //nolint
	RequestHeaderFieldsTooLarge  = &Error{} //nolint
	UnavailableForLegalReasons   = &Error{} //nolint

	InternalServerError           = &Error{} //nolint
	NotImplemented                = &Error{} //nolint
	BadGateway                    = &Error{} //nolint
	ServiceUnavailable            = &Error{} //nolint
	GatewayTimeout                = &Error{} //nolint
	HTTPVersionNotSupported       = &Error{} //nolint
	VariantAlsoNegotiates         = &Error{} //nolint
	InsufficientStorage           = &Error{} //nolint
	LoopDetected                  = &Error{} //nolint
	NotExtended                   = &Error{} //nolint
	NetworkAuthenticationRequired = &Error{} //nolint
)

Functions

func As

func As(err error, target any) bool

func Is

func Is(err, target error) bool

Types

type Error

type Error struct {
	Message string `json:"message,omitempty"`
	Params  []any  `json:"params,omitempty"`
}

func New

func New(text string) *Error

func Wrap

func Wrap(err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Pattern

func (e *Error) Pattern(value string, params ...any) error

example: e.Pattern("foo field must be in [0] and [1]", 10, 20)

Jump to

Keyboard shortcuts

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