code_err

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SystemErr  = NewCodeErr(-1, "系统错误")
	ParamsErr  = NewCodeErr(100001, "参数错误")
	TokenErr   = NewCodeErr(100002, "无效Token")
	EncryptErr = NewCodeErr(100003, "加密失败")
	DecryptErr = NewCodeErr(100004, "解密失败")
	SignErr    = NewCodeErr(100005, "签名失败")
)

Functions

This section is empty.

Types

type CodeErr

type CodeErr struct {
	Code int64
	Msg  string
}

func GetCodeErr

func GetCodeErr(err error) *CodeErr

func LogErr

func LogErr(ctx context.Context, codeErr *CodeErr, msg string, err error) *CodeErr

打印msg和err

func LogField

func LogField(ctx context.Context, codeErr *CodeErr, msg string, fields ...zap.Field) *CodeErr

打印field

func NewCodeErr

func NewCodeErr(code int64, msg string) *CodeErr

func (*CodeErr) Error

func (err *CodeErr) Error() string

type Log added in v1.1.6

type Log struct {
	Ctx context.Context
}

func NewLog added in v1.1.6

func NewLog(ctx context.Context) *Log

func (*Log) LogErr added in v1.1.6

func (c *Log) LogErr(codeErr *CodeErr, msg string, err error) *CodeErr

打印log

func (*Log) LogField added in v1.1.6

func (c *Log) LogField(codeErr *CodeErr, msg string, fields ...zap.Field) *CodeErr

打印log

Jump to

Keyboard shortcuts

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