er

package
v0.0.0-...-e765db0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingUsername means username is empty
	ErrMissingUsername = newAPPError(http.StatusBadRequest, 40001, "username is empty")

	// ErrMissingPassword means password is empty
	ErrMissingPassword = newAPPError(http.StatusBadRequest, 40002, "password is empty")
)
View Source
var (
	// ErrMissingToken means missing token in header
	ErrMissingToken = newAPPError(http.StatusUnauthorized, 40100, "missing token")

	// ErrAuthHeaderFormat means must provide Authorization header with format `Bearer {token}`
	ErrAuthHeaderFormat = newAPPError(http.StatusUnauthorized, 40101, "Must provide Authorization header with format `Bearer {token}`")

	// ErrPassword means password not equal
	ErrPassword = newAPPError(http.StatusUnauthorized, 40102, "password not equal")
)
View Source
var (
	// ErrGetUserByUsername means get user by username is failure
	ErrGetUserByUsername = newAPPError(http.StatusInternalServerError, 50001, "get user by username is failure")

	// ErrEncryptPassword means encrypt password is failure
	ErrEncryptPassword = newAPPError(http.StatusInternalServerError, 50002, "encrypt password is failure")

	// ErrSignup means signup is failure
	ErrSignup = newAPPError(http.StatusInternalServerError, 50003, "signup is failure")

	// ErrUsernameExists means username is exists
	ErrUsernameExists = newAPPError(http.StatusInternalServerError, 50004, "username is exists")
)
View Source
var (
	// ErrRateLimit means too many requests
	ErrRateLimit = newAPPError(http.StatusTooManyRequests, 42900, "too many requests")
)
View Source
var (
	// ErrUserNotExists means user is not exists
	ErrUserNotExists = newAPPError(http.StatusNotFound, 40400, "user is not exists")
)

Functions

This section is empty.

Types

type APPError

type APPError struct {
	Status int    `json:"-"`
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
}

APPError declare custom error

func (*APPError) Error

func (e *APPError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL