Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidQueryString = errors.New("the query string contains unparseable data. Please check the values") ErrInvalidBody = errors.New("the body of your request contains invalid or un-parseable data. Please check and try again") 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") ErrDatabaseReadOnly = errors.New("the database is currently in read-only mode, please try again later") ErrRequestBodyEmpty = errors.New("the request body must not be empty") ErrInvalidMonth = errors.New("could not parse the specified month, did you use YYYY-MM format?") ErrAccountNameNotUnique = errors.New("the account name must be unique for the budget") ErrCategoryNameNotUnique = errors.New("the category name must be unique for the budget") ErrEnvelopeNameNotUniqe = errors.New("the envelope name must be unique for the category") ErrMultipleAllocations = errors.New("you can not create multiple allocations for the same month") ErrSourceEqualsDestination = errors.New("source and destination accounts for a transaction must be different") ErrReferenceResourceDoesNotExist = errors.New("a resource you are referencing in another resource does not exist") ErrNoFilePost = errors.New("you must send a file to this endpoint") ErrFileEmpty = errors.New("the file you uploaded is empty or invalid") ErrAccountIDParameter = errors.New("the accountId parameter must be set") )
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.