e

package
v1.3.27 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamsValidatorErrorCode = 1000

	ParamsDealErrorCode = 1001

	NotFindErrorCode = 1002

	AuthorizeErrorCode = 1003

	InternalServerErrorCode = 1004

	RPCClientErrorCode = 1005

	RPCServerErrorCode = 1006

	AuthorizeTimeOutErrorCode = 1007
)
View Source
const (
	DuplicateEntry = "Duplicate entry"
)

Variables

View Source
var (
	ParamsValidatorError = Err{Code: ParamsValidatorErrorCode}

	ParamsDealError = Err{Code: ParamsDealErrorCode}

	NotFindError = Err{Code: NotFindErrorCode}

	AuthorizeError = Err{Code: AuthorizeErrorCode}

	AuthorizeTimeOutError = Err{Code: AuthorizeErrorCode}

	InternalServerError = Err{Code: InternalServerErrorCode}

	RPCClientErrorCodeError = Err{Code: RPCClientErrorCode}

	RPCServerErrorCodeError = Err{Code: RPCServerErrorCode}
)

控制器处理出错 错误码

View Source
var (
	RecordNotFound = "record not found"
)
View Source
var UpdateFailure = Err{Msg: "更新失败"}

Functions

func GetSite

func GetSite(line int) string

GetSite 获取行所在stack 1为当前位置

func PrintError

func PrintError(err error)

func SetCodeNameMap added in v1.3.2

func SetCodeNameMap(code int, name string)

Types

type Err

type Err struct {
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	Site   string `json:"site"`   //发生位置
	Err    error  `json:"-"`      //包裹错误
	ErrMsg string `json:"errMsg"` //包裹错误信息
}

func (Err) CodeName

func (e Err) CodeName() string

func (Err) Error

func (e Err) Error() string

func (Err) GetMsg

func (e Err) GetMsg() string

func (Err) Is added in v1.3.2

func (e Err) Is(err error) bool

func (Err) SetErr

func (e Err) SetErr(err error, msg ...string) Err

func (Err) SetRecover

func (e Err) SetRecover(r interface{}) Err

type WarpErr added in v1.3.2

type WarpErr struct {
	Error Err
}

func (WarpErr) Err added in v1.3.2

func (e WarpErr) Err(args ...any) Err

Jump to

Keyboard shortcuts

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