errcode

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UnknownErrCode      = err{0, "未知错误"}
	InternalErr         = err{-1, "服务器内部错误"}
	Success             = err{200, "successful"} // 成功
	VerifyErr           = err{401, "验证失败"}
	MetaCoderNotFound   = err{402, "meta解码器未注册"}
	ProtoMsgIdNoHandles = err{403, "该协议未注册"}
	ServiceNotFound     = err{404, "未找到该服务"}
	InvalidParam        = err{412, "无效参数"}
	Overload            = err{503, "请求超载"}
)

Functions

This section is empty.

Types

type IErr

type IErr interface {
	Error() string
	ErrMsg() string
	Code() int32
}

IErr 自定义错误接口

func New

func New(code int32, errMsg string) IErr

New 创建一个错误码,业务逻辑上的错误,错误码使用1000-1999

func WithErrcode

func WithErrcode(code int32, err_ error) IErr

Jump to

Keyboard shortcuts

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