Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = WithStatus(WithDescription(nil, "resource not found", "the requested resource has not been found"), http.StatusNotFound)
ErrNotFound is thrown whenever the requested resource could not be found.
ErrUnauthorized is thrown whenever a user calls an unauthorized endpoint.
var ErrUnimplemented = WithStatus(WithDescription(nil, "unimplemented endpoint", "the requested endpoint has not yet been implemented"), http.StatusNotImplemented)
ErrUnimplemented is thrown whenever an unimplemented endpoint has been called.
Functions ¶
func AsDescription ¶
AsDescription sets the error content as the error description.
func GetDescription ¶
GetDescription attempts to unwrap the human readable description of the given error. The default HTTP status text for the underlaying probem status is returned if no description has been found.
func GetStatus ¶
GetStatus returns the underlying error status. Statuses are based on the registered IANA statuses. If no status has been found is the default internal server error status code returned. https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
func WithDescription ¶
WithDescription wraps a human readable title and description around the given error. The title should represent a short summary of the problem. The details should include details on how to resolve the given error. If multiple details are given they will be joined using a new line character.
func WithStatus ¶
WithStatus wraps the given status around the given error. This status is returned to the client defining the error category.
Types ¶
This section is empty.