Documentation
¶
Overview ¶
Package errors provides a way to create and handle errors with types and messages. Errors from this package are used to set the status code of API responses based on the Type of the Error.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error represents an error with a type and a message. It wraps the original error if one is provided.
func New ¶
New creates a new error with the given type, wrapped error, message and arguments. The message is formatted using fmt.Sprintf with the provided arguments.
type Type ¶
type Type = uint8
Type represents the type of error. It should represent the status code that should be returned in the API response.
const ( // TypeUnknown is used when the error type is not known. TypeUnknown Type = iota // TypeBadRequest is used when the request is invalid. TypeBadRequest // TypeNotFound is used when the requested resource is not found. TypeNotFound TypeUnauthorized // TypeForbidden is used when the request is forbidden. TypeForbidden )
Click to show internal directories.
Click to hide internal directories.