Documentation ¶
Index ¶
- Variables
- func EnsureHasKey[K comparable, V any](value map[K]V, key K, format string, args ...any)
- func EnsureNotEmpty(pointer any, format string, args ...any)
- func FromHttpStatus(status int) error
- func IsNotFound(err error) bool
- func New(code string, msg string, httpStatus int) error
- func NewCancellationError(entity string, keyFmt string, args ...interface{}) error
- func NewConditionNotMetError(entity string, keyFmt string, args ...interface{}) error
- func NewDuplicateError(entity string, details string, keyFmt string, args ...interface{}) error
- func NewForbiddenError(entity string, keyFmt string, args ...interface{}) error
- func NewFoundManyError(entity string, keyFmt string, args ...interface{}) error
- func NewGatewayError(entity string, keyFmt string, args ...interface{}) error
- func NewInvalidArgumentError(entity string, keyFmt string, args ...interface{}) error
- func NewInvalidEventTypeError(entity string, keyFmt string, args ...interface{}) error
- func NewInvalidStateError(entity string, keyFmt string, args ...interface{}) error
- func NewNotFoundError(entity string, keyFmt string, args ...interface{}) error
- func NewTimeoutError(entity string, keyFmt string, args ...interface{}) error
- func NewTypeAssertionError(entity string, keyFmt string, args ...interface{}) error
- func NewUnauthorized(keyFmt string, args ...interface{}) error
- func NewUnknownError(entity string, details string, keyFmt string, args ...interface{}) error
- type HttpError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = New("not-found", "not found for", http.StatusNotFound) ErrDuplicate = New("duplicate", "duplicate", http.StatusConflict) ErrFoundMany = New("found-many", "found many but one expected", http.StatusConflict) ErrTypeAssertion = New("invalid-type", "type assertion failed", http.StatusInternalServerError) ErrUnknown = New("unknown", "unknown error found", http.StatusInternalServerError) ErrInvalidArgument = New("invalid-argument", "invalid argument", http.StatusBadRequest) ErrInvalidState = New("invalid-state", "invalid state", http.StatusPreconditionFailed) ErrClientCanceled = New("cancelled", "client cancelled", 460) ErrTimeout = New("timeout", "timeout", http.StatusGatewayTimeout) ErrGateway = New("gateway", "gateway", http.StatusBadGateway) ErrForbidden = New("forbidden", "user is not allowed to perform operation", http.StatusForbidden) // Not enough permissions ErrInvalidEventType = New("invalid-event-type", "invalid event type", http.StatusInternalServerError) ErrConditionNotMet = New("condition-not-met", "condition not met", http.StatusPreconditionFailed) )
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 ¶
EnsureNotEmpty panics if the given pointer is nil, or value is empty string, or numeric 0.
func FromHttpStatus ¶
func IsNotFound ¶
func NewCancellationError ¶
func NewConditionNotMetError ¶
func NewDuplicateError ¶
func NewForbiddenError ¶
func NewFoundManyError ¶
func NewGatewayError ¶
func NewInvalidArgumentError ¶
func NewInvalidStateError ¶
func NewNotFoundError ¶
func NewTimeoutError ¶
func NewTypeAssertionError ¶
func NewUnauthorized ¶
Types ¶
type HttpError ¶
type HttpError struct {
// contains filtered or unexported fields
}
func (HttpError) HTTPStatus ¶
Click to show internal directories.
Click to hide internal directories.