Documentation
¶
Overview ¶
Package errors provides error handling utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("resource not found") ErrInvalidInput = errors.New("invalid input") ErrInternal = errors.New("internal error") ErrForbidden = errors.New("forbidden") ErrTimeout = errors.New("operation timed out") ErrNotImplemented = errors.New("not implemented") )
Standard error types
Functions ¶
func As ¶
As finds the first error in err's chain that matches target and sets target to that error value.
func GetContext ¶
GetContext returns the context of an error. If the error is not a *Error, nil is returned.
Types ¶
type Category ¶
type Category int
Category represents the category of an error
const ( // CategoryUnknown is used when the error category is not known CategoryUnknown Category = iota // CategoryConfiguration is used for configuration-related errors CategoryConfiguration // CategoryValidation is used for input validation errors CategoryValidation // CategoryExternal is used for errors from external services CategoryExternal // CategorySystem is used for system-level errors CategorySystem // CategoryApplication is used for application-level errors CategoryApplication )
func GetCategory ¶
GetCategory returns the category of an error. If the error is not a *Error, CategoryUnknown is returned.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a custom error with additional context information.
func (*Error) WithContext ¶
WithContext adds context information to the error.
Click to show internal directories.
Click to hide internal directories.