Documentation
¶
Index ¶
- Variables
- func Combine(errors ...error) error
- func Has(err error, cause error) bool
- func Is(err error, c Category) bool
- func Message(err error) string
- func New(opts ...Option) error
- func Newf(format string, args ...any) error
- func Wrap(err error, opts ...Option) error
- func Wrapf(err error, format string, args ...any) error
- type Category
- type Error
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Cancaled = NewCategory("Cancelled", 499) // non-standard status code for cancellation BadRequest = NewCategory("BadRequest", http.StatusBadRequest) InvalidArgument = NewCategory("InvalidArgument", http.StatusBadRequest) Forbidden = NewCategory("Forbidden", http.StatusForbidden) PermissionDenied = NewCategory("PermissionDenied", http.StatusForbidden) NotFound = NewCategory("NotFound", http.StatusNotFound) DeadlineExceeded = NewCategory("DeadlineExceeded", http.StatusRequestTimeout) Conflict = NewCategory("Conflict", http.StatusConflict) AlreadyExist = NewCategory("AlreadyExist", http.StatusConflict) TooManyRequests = NewCategory("TooManyRequests", http.StatusTooManyRequests) Internal = NewCategory("Internal", http.StatusInternalServerError) NotImplemented = NewCategory("NotImplemented", http.StatusNotImplemented) ResourceExhausted = NewCategory("ResourceExhausted", http.StatusServiceUnavailable) DBFailed = NewCategory("DBFailed", http.StatusInternalServerError) )
Functions ¶
Types ¶
type Category ¶
type Category interface {
Error() string
StatusCode() int
New(opts ...Option) error
Newf(format string, args ...any) error
Wrap(err error, opts ...Option) error
Wrapf(err error, format string, args ...any) error
}
func NewCategory ¶
NewCategory creates a new error category with the given description and HTTP status code
Click to show internal directories.
Click to hide internal directories.