Documentation
¶
Overview ¶
Package errdefs provides behavior-based error classification.
Errors are classified by marker interfaces rather than error codes. Each category has three associated items:
- An unexported marker interface (e.g. interface{ NotFound() })
- A constructor that wraps/creates errors with the marker
- A check function (e.g. IsNotFound)
Sentinel errors remain plain stdlib errors; classification is orthogonal to identity — errors.Is checks identity, IsXxx checks category.
Index ¶
- Variables
- func Aborted(err error) error
- func Abortedf(format string, args ...any) error
- func Conflict(err error) error
- func Conflictf(format string, args ...any) error
- func Fmt(format string, args ...any) error
- func Forbidden(err error) error
- func Forbiddenf(format string, args ...any) error
- func HTTPStatus(err error) int
- func Internal(err error) error
- func Internalf(format string, args ...any) error
- func Interrupted(err error) error
- func Interruptedf(format string, args ...any) error
- func IsAborted(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsInternal(err error) bool
- func IsInterrupted(err error) bool
- func IsNotAvailable(err error) bool
- func IsNotFound(err error) bool
- func IsRateLimit(err error) bool
- func IsTimeout(err error) bool
- func IsUnauthorized(err error) bool
- func IsValidation(err error) bool
- func New(text string) error
- func NotAvailable(err error) error
- func NotAvailablef(format string, args ...any) error
- func NotFound(err error) error
- func NotFoundf(format string, args ...any) error
- func RateLimit(err error) error
- func RateLimitf(format string, args ...any) error
- func Timeout(err error) error
- func Timeoutf(format string, args ...any) error
- func Unauthorized(err error) error
- func Unauthorizedf(format string, args ...any) error
- func Validation(err error) error
- func Validationf(format string, args ...any) error
Constants ¶
This section is empty.
Variables ¶
Re-export standard library functions so callers only need one import.
Functions ¶
func Forbiddenf ¶
func HTTPStatus ¶
HTTPStatus returns the HTTP status code for an error based on its category. Unknown/uncategorized errors map to 500 Internal Server Error.
func Interrupted ¶
func Interruptedf ¶
func IsConflict ¶
func IsForbidden ¶
func IsInternal ¶
func IsInterrupted ¶
func IsNotAvailable ¶
func IsNotFound ¶
func IsRateLimit ¶
func IsUnauthorized ¶
func IsValidation ¶
func NotAvailable ¶
func NotAvailablef ¶
func RateLimitf ¶
func Unauthorized ¶
func Unauthorizedf ¶
func Validation ¶
func Validationf ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.