Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidQueryString = errors.New("the query string contains unparseable data. Please check the values") ErrInvalidUUID = errors.New("the specified resource ID is not a valid UUID") ErrNoResource = errors.New("there is no resource for the ID you specified") ErrDatabaseClosed = errors.New("there is a problem with the database connection, please try again later") ErrRequestBodyEmpty = errors.New("the request body must not be empty") )
Functions ¶
func Handler ¶
Handler handles errors for fetching data from the database.
This function is deprecated. Use Parse and handle HTTP responses in the calling function.
func InvalidMonth ¶
func InvalidQueryString ¶
func InvalidUUID ¶
Types ¶
type Error ¶ added in v3.5.0
type Error struct {
Err error
Status int // Used with http.StatusX for the corresponding HTTP status code
}
Error is used to return an error with the corresponding HTTP status code to a controller.
func DBError ¶
DBError returns an error message and status code appropriate to the error that has occurred.
func GenericDBError ¶
GenericDBError wraps DBError with a more specific error message for not found errors.
func Parse ¶ added in v3.5.0
Parse parses an error and returns an appropriate Error struct.
If the error is not well known, it is logged and a generic message with the Request ID returned. This is done to prevent leaking sensitive data.
Click to show internal directories.
Click to hide internal directories.