errx

package
v0.0.0-...-861475b Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// OK 成功
	OK uint32 = 0
	// ServerCommonError 默认系统错误
	ServerCommonError uint32 = 999901
	// RequestParamError 参数错误
	RequestParamError uint32 = 999910
	// PageNotFound 404
	PageNotFound uint32 = 999911
	// DbError 数据库操作失败
	DbError uint32 = 999902

	// UserNotRegisterError 用户未注册
	UserNotRegisterError = 200112
	// UserNotFoundError 用户不存在
	UserNotFoundError = 200113
	// UserAlreadyExistError 用户已存在
	UserAlreadyExistError = 200114
	// UserForbiddenError 用户被禁用
	UserForbiddenError = 200115
	// UserLoginFailError 用户登录失败
	UserLoginFailError = 200116

	// LoginTypeNotSupportError 登录方式未支持
	LoginTypeNotSupportError = 200117
	// LoginPasswordIncorrectError 登录密码错误
	LoginPasswordIncorrectError = 200118
)

* - 服务编号:10=API、20=RPC、30=Websocket。 - 接口类型(增删查改): 01=POST,02=DELETE,03=GET,04=PUT。 - 错误来源: 表示错误属于那种类型,两位数字递增。01=内部调用错误、02=数据库报错、03=缓存服务报错、04=第三方服务报错、10=参数错误、11=具体业务错误。 示例:API模块 用户登录接口 手机号格式错误

10  +    01    +     10    = 100110

*

View Source
const (
	UnknownError = "未知错误,请联系客服人员!"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeError

type CodeError struct {
	Code uint32      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func NewErrCode

func NewErrCode(errCode uint32) *CodeError

func NewErrCodeMsg

func NewErrCodeMsg(errCode uint32, errMsg string) *CodeError

func (*CodeError) Error

func (e *CodeError) Error() string

func (*CodeError) ErrorDetail

func (e *CodeError) ErrorDetail() string

func (*CodeError) GetErrCode

func (e *CodeError) GetErrCode() uint32

GetErrCode 返回给前端的错误码

func (*CodeError) GetErrData

func (e *CodeError) GetErrData() interface{}

GetErrData 开发环境返回给前端所有错误堆栈信息

func (*CodeError) GetErrMsg

func (e *CodeError) GetErrMsg() string

GetErrMsg 返回给前端显示端错误信息

Jump to

Keyboard shortcuts

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