xerr

package
v0.0.0-...-39337ee Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK = 0 // 成功

	CLIENT_ERROR = 4000 // 客户端自身错误
	UNAUTHORIZED = 4001 // 身份认证失败
	PARAM_ERROR  = 4002 // 缺少必传参数
	NO_DATA      = 4003 // 没有数据
	DATA_EXIST   = 4004 // 数据已存在

	SERVER_ERROR  = 5000 // 服务端开小差啦,请稍后再试一试
	DB_ERROR      = 5001 // 数据库操作异常
	CACHE_ERROR   = 5002 // 缓存操作异常
	MARSHAL_ERROR = 5003 // 序列化异常
	MQ_ERROR      = 5004 // 消息队列操作异常
	WS_ERROR      = 5005 // websocket操作异常
)

通用状态码

Variables

This section is empty.

Functions

func CodeToMsg

func CodeToMsg(code uint32) string

func IsCodeErr

func IsCodeErr(code uint32) bool

func NewErrCode

func NewErrCode(code uint32) error

func NewErrCodeMsg

func NewErrCodeMsg(code uint32, msg string) error

func NewErrMsg

func NewErrMsg(msg string) error

Types

type CodeError

type CodeError struct {
	// contains filtered or unexported fields
}

func (*CodeError) Error

func (e *CodeError) Error() string

func (*CodeError) GetCode

func (e *CodeError) GetCode() uint32

func (*CodeError) GetMsg

func (e *CodeError) GetMsg() string

Jump to

Keyboard shortcuts

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