Documentation ¶
Overview ¶
Package errors contains reusable error messages and other helpers for dealing with errors.
Index ¶
Constants ¶
View Source
const ( MessageInternalServerError = "the server encountered a problem and could not process your request" MessageTooManyRequests = "rate limit exceeded" MessageForbidden = "user has no access to this resource" )
Variables ¶
View Source
var ( // ErrFailedValidation is used when validation by [validate.Validator] failed. ErrFailedValidation = errors.New("failed validation") )
Functions ¶
This section is empty.
Types ¶
type BadRequestError ¶
type BadRequestError struct {
// contains filtered or unexported fields
}
BadRequestError is used to return a bad request response.
func NewBadRequestError ¶
func NewBadRequestError(err error) BadRequestError
NewBadRequestError creates a new BadRequestError.
func (BadRequestError) Error ¶
func (err BadRequestError) Error() string
type ConflictError ¶
type ConflictError struct { JSONField string // contains filtered or unexported fields }
ConflictError is used when an existing resource would conflict with a new resource.
func NewConflictError ¶
func NewConflictError( resourceName string, identifierValue any, jsonField string, ) ConflictError
NewConflictError creates a new ConflictError.
func (ConflictError) Error ¶
func (err ConflictError) Error() string
type ErrorDto ¶
type ErrorDto struct { Status int `json:"status"` Error string `json:"error"` Message any `json:"message"` } // @name ErrorDto
ErrorDto is used to return the error back to the client.
type NotFoundError ¶
type NotFoundError struct { JSONField string // contains filtered or unexported fields }
NotFoundError is used when a certain resource doesn't exist.
func NewNotFoundError ¶
func NewNotFoundError( resourceName string, identifierValue any, jsonField string, ) NotFoundError
NewNotFoundError creates a new NotFoundError.
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type UnauthorizedError ¶
type UnauthorizedError struct {
// contains filtered or unexported fields
}
UnauthorizedError is used to return an unauthorized response.
func NewUnauthorizedError ¶
func NewUnauthorizedError(err error) UnauthorizedError
NewUnauthorizedError creates a new UnauthorizedError.
func (UnauthorizedError) Error ¶
func (err UnauthorizedError) Error() string
Click to show internal directories.
Click to hide internal directories.