code_err

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SystemErr  = NewCodeErr(-1, "SystemError")
	ParamsErr  = NewCodeErr(100001, "ParamsError")
	TokenErr   = NewCodeErr(100002, "InvalidToken")
	EncryptErr = NewCodeErr(100003, "EncryptionError")
	DecryptErr = NewCodeErr(100004, "DecryptionError")
	SignErr    = NewCodeErr(100005, "SignatureError")
)

Functions

This section is empty.

Types

type CodeErr

type CodeErr struct {
	Code     int64  `json:"code"`
	Msg      string `json:"msg"`
	DebugMsg string `json:"debug_msg"`
}

func GetCodeErr

func GetCodeErr(err error) *CodeErr

func New added in v1.1.10

func New(code int64, msg string, debugMsg string) *CodeErr

func NewCodeErr

func NewCodeErr(code int64, msg string) *CodeErr

func (*CodeErr) Error

func (err *CodeErr) Error() string

func (*CodeErr) LogErr added in v1.1.10

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

打印msg和err

func (*CodeErr) LogField added in v1.1.10

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

打印field

func (*CodeErr) SetDebugMsg added in v1.1.10

func (codeErr *CodeErr) SetDebugMsg(debugMsg string) *CodeErr

设置新的debug msg

func (*CodeErr) WithDebugMsg added in v1.1.10

func (codeErr *CodeErr) WithDebugMsg(debugMsg string) *CodeErr

debug msg初始化新的CodeErr

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