Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorCtxResponse(ctx echo.Context, err error) error
- func ErrorResponse(err error) (int, interface{})
- type Error
- type RestErr
- func NewBadRequestError(causes interface{}) RestErr
- func NewForbiddenError(causes interface{}) RestErr
- func NewInternalServerError(causes interface{}) RestErr
- func NewNotFoundError(causes interface{}) RestErr
- func NewRestError(status int, err string, causes interface{}) RestErr
- func NewRestErrorFromBytes(bytes []byte) (RestErr, error)
- func NewRestErrorWithMessage(status int, err string, causes interface{}) RestErr
- func NewUnauthorizedError(causes interface{}) RestErr
- func ParseErrors(err error) RestErr
- type RestError
Constants ¶
View Source
const ( ErrBadRequest = "Bad request" ErrAlreadyExists = "Already exists" ErrNoSuchUser = "User not found" ErrWrongCredentials = "Wrong Credentials" ErrNotFound = "Not Found" ErrForbidden = "Forbidden" ErrBadQueryParams = "Invalid query params" ErrRequestTimeout = "Request Timeout" ErrInvalidEmail = "Invalid email" ErrInvalidPassword = "Invalid password" ErrInvalidField = "Invalid field" )
Variables ¶
View Source
var ( BadRequest = Error("bad request") WrongCredentials = Error("wrong Credentials") NotFound = Error("not Found") Forbidden = Error("forbidden") PermissionDenied = Error("permission Denied") ExpiredCSRFError = Error("expired CSRF token") WrongCSRFToken = Error("wrong CSRF token") CSRFNotPresented = Error("CSRF not presented") NotRequiredFields = Error("no such required fields") BadQueryParams = Error("invalid query params") InternalServerError = Error("internal Server Error") RequestTimeoutError = Error("request Timeout") ExistsEmailError = Error("user with given email already exists") InvalidJWTToken = Error("invalid JWT token") InvalidJWTClaims = Error("invalid JWT claims") NotAllowedImageHeader = Error("not allowed image header") NoCookie = Error("not found cookie header") InvalidUUID = Error("invalid uuid") )
Functions ¶
func ErrorCtxResponse ¶
Error response object and status code
Types ¶
type RestErr ¶
Rest error interface
func NewInternalServerError ¶
func NewInternalServerError(causes interface{}) RestErr
New Internal Server Error
func NewRestError ¶
New Rest Error
func NewRestErrorFromBytes ¶
New Rest Error From Bytes
func NewRestErrorWithMessage ¶
New Rest Error With Message
func NewUnauthorizedError ¶
func NewUnauthorizedError(causes interface{}) RestErr
New Unauthorized Error
func ParseErrors ¶
Parser of error string messages returns RestError
Click to show internal directories.
Click to hide internal directories.