{"modulePath":"github.com/AltScore/gothic","version":"v0.49.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package xerrors\n\n## Variables\n\n```go\nvar (\n\tErrNotFound         = New(\"not-found\", \"not found for\", http.StatusNotFound)\n\tErrDuplicate        = New(\"duplicate\", \"duplicate\", http.StatusConflict)\n\tErrFoundMany        = New(\"found-many\", \"found many but one expected\", http.StatusConflict)\n\tErrTypeAssertion    = New(\"invalid-type\", \"type assertion failed\", http.StatusInternalServerError)\n\tErrUnknown          = New(\"unknown\", \"unknown error found\", http.StatusInternalServerError)\n\tErrInvalidArgument  = New(\"invalid-argument\", \"invalid argument\", http.StatusBadRequest)\n\tErrInvalidState     = New(\"invalid-state\", \"invalid state\", http.StatusPreconditionFailed)\n\tErrClientCanceled   = New(\"cancelled\", \"client cancelled\", 460)\n\tErrTimeout          = New(\"timeout\", \"timeout\", http.StatusGatewayTimeout)\n\tErrGateway          = New(\"gateway\", \"gateway\", http.StatusBadGateway)\n\tErrUnauthorized     = New(\"unauthorized\", \"user did not provided credentials\", http.StatusUnauthorized)  // Not authenticated,\n\tErrForbidden        = New(\"forbidden\", \"user is not allowed to perform operation\", http.StatusForbidden) // Not enough permissions\n\tErrInvalidEventType = New(\"invalid-event-type\", \"invalid event type\", http.StatusInternalServerError)\n\tErrConditionNotMet  = New(\"condition-not-met\", \"condition not met\", http.StatusPreconditionFailed)\n)\n```\n\n## Functions\n\n```go\nfunc EnsureHasKey[K comparable, V any](value map[K]V, key K, format string, args ...any)\n```\nEnsureHasKey panics if the given map does not contain the given key.\n\n```go\nfunc EnsureNotEmpty(pointer any, format string, args ...any)\n```\nEnsureNotEmpty panics if the given pointer is nil, or value is empty string, or numeric 0.\n\n```go\nfunc FromHttpStatus(status int) error\n```\n\n```go\nfunc IsNotFound(err error) bool\n```\n\n```go\nfunc New(code string, msg string, httpStatus int) error\n```\n\n```go\nfunc NewCancellationError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewConditionNotMetError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewDuplicateError(entity string, details string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewForbiddenError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewFoundManyError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewGatewayError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewInvalidArgumentError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewInvalidEventTypeError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewInvalidStateError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewNotFoundError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewTimeoutError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewTypeAssertionError(entity string, keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewUnauthorized(keyFmt string, args ...interface{}) error\n```\n\n```go\nfunc NewUnknownError(entity string, details string, keyFmt string, args ...interface{}) error\n```\n\n## Types\n\n```go\ntype HttpError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e HttpError) Code() string\n```\n\n```go\nfunc (e HttpError) Error() string\n```\n\n```go\nfunc (e HttpError) HTTPStatus() int\n```\n\n```go\nfunc (e HttpError) Unwrap() error\n```\n\n","path":"github.com/AltScore/gothic/pkg/xerrors","name":"xerrors","synopsis":"","isRedistributable":true}
