Documentation
¶
Index ¶
- Constants
- func ClientError(w http.ResponseWriter, status int)
- func NotFound(w http.ResponseWriter)
- func ServerError(w http.ResponseWriter, err error)
- type CustomError
- func DBError(err error, message string) *CustomError
- func Forbidden(message string) *CustomError
- func InternalServerError(message string) *CustomError
- func New(code, message string) *CustomError
- func StatusNotFound(message string) *CustomError
- func UnauthorizedError(message string) *CustomError
- func UserNotFound(message string) *CustomError
- func ValidationError(message string) *CustomError
- func Wrap(err error, code, message string) *CustomError
Constants ¶
View Source
const ( // User-related errors ErrStatusNotFound = "NOT_FOUND" ErrUserNotFound = "USER_NOT_FOUND" ErrInvalidCredentials = "INVALID_CREDENTIALS" ErrInvalidUsername = "INVALID_USERNAME_FORMAT" ErrWeakPassword = "WEAK_PASSWORD" ErrEmailExists = "EMAIL_ALREADY_EXISTS" ErrInvalidEmail = "INVALID_EMAIL_FORMAT" // Backend errors ErrDBError = "DB_ERROR" ErrValidationError = "VALIDATION_ERROR" // General errors ErrBadRequest = "BAD_REQUEST" ErrConflict = "CONFLICT_DETECTED" ErrOrderStatusNotFound = "ORDER_STATUS_NOT_FOUND" // Authentication & Authorization errors ErrForbidden = "FORBIDDEN" ErrInternalServer = "INTERNAL_SERVER_ERROR" )
Variables ¶
This section is empty.
Functions ¶
func ClientError ¶
func ClientError(w http.ResponseWriter, status int)
func NotFound ¶
func NotFound(w http.ResponseWriter)
func ServerError ¶
func ServerError(w http.ResponseWriter, err error)
Types ¶
type CustomError ¶
func DBError ¶
func DBError(err error, message string) *CustomError
func Forbidden ¶
func Forbidden(message string) *CustomError
func InternalServerError ¶
func InternalServerError(message string) *CustomError
func New ¶
func New(code, message string) *CustomError
func StatusNotFound ¶
func StatusNotFound(message string) *CustomError
func UnauthorizedError ¶
func UnauthorizedError(message string) *CustomError
func UserNotFound ¶
func UserNotFound(message string) *CustomError
func ValidationError ¶
func ValidationError(message string) *CustomError
func Wrap ¶
func Wrap(err error, code, message string) *CustomError
func (*CustomError) Error ¶
func (e *CustomError) Error() string
func (*CustomError) UnWrap ¶
func (e *CustomError) UnWrap() error
Click to show internal directories.
Click to hide internal directories.