Documentation ¶
Index ¶
- Constants
- Variables
- func GetErrCodeMsg(err error) (errCode uint32, errMsg string)
- func Init(errs map[uint32]string)
- func IsCodeErr(errcode uint32) bool
- func IsErrCode(err error, code uint32) bool
- func MapErrMsg(errcode uint32) string
- func NewError(errCode uint32) error
- func NewErrorMsg(errCode uint32, errMsg string) error
- type CodeError
Constants ¶
View Source
const CAPTCHA_ERROR uint32 = 700
View Source
const DB_ERROR uint32 = 555
View Source
const FORBIDDEN_ERROR uint32 = 403
View Source
const NOT_FOUND_ERROR uint32 = 404
View Source
const OK uint32 = 0
成功返回
View Source
const REDIS_ERROR uint32 = 666
View Source
const REQUEST_PARAM_ERROR uint32 = 400
全局错误码 client
View Source
const SERVER_COMMON_ERROR uint32 = 500
server
View Source
const TOKEN_EXPIRE_ERROR uint32 = 401
View Source
const USER_EXISTS_ERROR uint32 = 704
View Source
const USER_LOGIN_ERROR uint32 = 703
View Source
const USER_NOT_EXISTS_ERROR uint32 = 701
Variables ¶
View Source
var ( ErrNotFound = NewErrCodeMsg(NOT_FOUND_ERROR, "not found") ErrUserNoExists = NewErrCodeMsg(USER_NOT_EXISTS_ERROR, "user not found") ErrUserExists = NewErrCodeMsg(USER_EXISTS_ERROR, "user exists") ErrUserForbidden = NewErrCode(FORBIDDEN_ERROR) ErrUserLogin = NewErrCode(USER_LOGIN_ERROR) ErrCaptcha = NewErrCodeMsg(CAPTCHA_ERROR, "captcha error") ErrRequestParamError = NewErrCode(REQUEST_PARAM_ERROR) ErrDBError = NewErrCode(DB_ERROR) ErrServerError = NewErrCode(SERVER_COMMON_ERROR) ErrRedisError = NewErrCode(REDIS_ERROR) )
Functions ¶
func GetErrCodeMsg ¶
func NewErrorMsg ¶ added in v1.2.98
Types ¶
type CodeError ¶
type CodeError struct {
// contains filtered or unexported fields
}
func NewErrCode ¶
func NewErrCodeMsg ¶
func NewParamErrMsg ¶
Click to show internal directories.
Click to hide internal directories.