code_err

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 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 SvcContext

type SvcContext struct {
	Ctx context.Context
}

func NewSvcContext

func NewSvcContext(ctx context.Context) *SvcContext

func (*SvcContext) LogErr

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

打印log

func (*SvcContext) LogField

func (c *SvcContext) 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