errorx

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrMsg

func ErrMsg(code ErrCode) string

func IsErrCode

func IsErrCode(code ErrCode) bool

Types

type ErrCode

type ErrCode uint
const (
	SUCCESS ErrCode = 0 //成功返回
	/**(前2位代表业务,后2位代表具体功能)**/
	FAILED               ErrCode = 1001 //失败返回
	PARAM_ERROR          ErrCode = 1002
	DATA_NOT_FOUND       ErrCode = 1003 //数据未找到
	TOKEN_EXPIRE         ErrCode = 2001
	TOKEN_GENERATE_ERROR ErrCode = 2002
	TOKEN_PARSE_ERROR    ErrCode = 2003
	DB_ERROR             ErrCode = 3001
)

func (ErrCode) String

func (e ErrCode) String() string

type Error

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

func NewErrCode

func NewErrCode(code ErrCode) *Error

func NewErrCodeMsg

func NewErrCodeMsg(code ErrCode, msg string) *Error

func NewErrMsg

func NewErrMsg(msg string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetCode

func (e *Error) GetCode() ErrCode

func (*Error) GetMsg

func (e *Error) GetMsg() string

Jump to

Keyboard shortcuts

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