errcode

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 2 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

func Errors added in v0.0.4

func Errors(errs ...error) error

Types

type IErr

type IErr interface {
	Error() string
	ErrMsg() string
	Code() int32
	WithErr(err_ error) IErr
	WithMsg(msg string) IErr
}

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