xerrors

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	NotFoundReason         = "not found for"
	DuplicateReason        = "duplicate"
	FoundManyReason        = "found many but one expected"
	TypeAssertionReason    = "type assertion failed"
	UnknownReason          = "unknown error found"
	InvalidArgumentReason  = "invalid argument"
	InvalidStateReason     = "invalid state"
	ClientCanceledReason   = "client cancelled"
	TimeoutReason          = "timeout"
	GatewayReason          = "gateway"
	UnauthorizedReason     = "unauthorized" // Not authenticated
	ForbiddenReason        = "forbidden"
	InvalidEventTypeReason = "invalid event type"
)

Variables

This section is empty.

Functions

func EnsureHasKey

func EnsureHasKey[K comparable, V any](value map[K]V, key K, format string, args ...any)

EnsureHasKey panics if the given map does not contain the given key.

func EnsureNotEmpty

func EnsureNotEmpty(value string, format string, args ...any)

EnsureNotEmpty panics if the given string is empty.

func EnsureNotNil

func EnsureNotNil(pointer any, format string, args ...any)

EnsureNotNil panics if the given pointer is nil.

func IsNotFound

func IsNotFound(err error) bool

Types

type Error

type Error struct {
	Entity  string
	Key     string
	Reason  string
	Details string
	// contains filtered or unexported fields
}

func NewCancellationError

func NewCancellationError(entity string, keyFmt string, args ...interface{}) Error

func NewDuplicateError

func NewDuplicateError(entity string, details string, keyFmt string, args ...interface{}) Error

func NewForbiddenError

func NewForbiddenError(entity string, keyFmt string, args ...interface{}) Error

func NewFoundManyError

func NewFoundManyError(entity string, keyFmt string, args ...interface{}) Error

func NewGatewayError

func NewGatewayError(entity string, keyFmt string, args ...interface{}) Error

func NewInvalidArgumentError

func NewInvalidArgumentError(entity string, keyFmt string, args ...interface{}) Error

func NewInvalidEventTypeError

func NewInvalidEventTypeError(entity string, keyFmt string, args ...interface{}) Error

func NewInvalidStateError

func NewInvalidStateError(entity string, keyFmt string, args ...interface{}) Error

func NewNotFoundError

func NewNotFoundError(entity string, keyFmt string, args ...interface{}) Error

func NewTimeoutError

func NewTimeoutError(entity string, keyFmt string, args ...interface{}) Error

func NewTypeAssertionError

func NewTypeAssertionError(entity string, keyFmt string, args ...interface{}) Error

func NewUnauthorized

func NewUnauthorized(keyFmt string, args ...interface{}) Error

func NewUnknownError

func NewUnknownError(entity string, details string, keyFmt string, args ...interface{}) Error

func (Error) Error

func (e Error) Error() string

func (Error) HTTPStatus

func (e Error) HTTPStatus() int

func (Error) Type

func (e Error) Type() string

func (Error) Unwrap

func (e Error) Unwrap() error

Jump to

Keyboard shortcuts

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