wrong

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE_ERROR      = iota
	VERSION_ERROR   //版本不正确
	ACCOUNT_NOEXIST //账号不存在
	PASSWORD_ERROR  //密码不正确
)

Variables

This section is empty.

Functions

func DecodeErr

func DecodeErr(err error) (int, string)

解码错误, 获取 Code 和 Message

func Panic

func Panic(code int, err error, message ...string)

func TraceCode

func TraceCode(code ...interface{})

TraceCode 输出错误,跟踪代码

func Try

func Try(fun func(), handler func(interface{}))

Types

type Err

type Err struct {
	Code    int         `json:"status_code"` // 错误码
	Message string      `json:"message"`     // 展示给用户看的
	Errord  error       // 保存内部错误信息
	Debug   interface{} `json:"debug"`
	Trace   string      `json:"trace"`
	// contains filtered or unexported fields
}

定义错误

func New

func New(code int, err error, message ...string) *Err

New returns an error that formats as the given text.

func (*Err) Error

func (err *Err) Error() string

func (*Err) Format

func (err *Err) Format() string

Jump to

Keyboard shortcuts

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