errors

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelNormal = 1
	LevelFatal  = 2
)

错误级别

View Source
const (
	ErrorCodeRouter = 10001 // 路由问题
	ErrorCodeAuth   = 10010 // 认证问题
)

错误码

Variables

This section is empty.

Functions

func NewFatal

func NewFatal(code int, msg string) error

NewFatal 新建严重错误

func NewNormal

func NewNormal(code int, msg string) error

NewNormal 新建普通错误

Types

type Error

type Error struct {
	Code int    `json:"code"` // 请求返回码,一般0表示正常,非0表示异常
	Msg  string `json:"msg"`  // 信息,一般是出错时的描述信息
	// contains filtered or unexported fields
}

Error 错误

func (Error) Error

func (e Error) Error() string

Error 实现error接口

func (Error) IsFatal

func (e Error) IsFatal() bool

IsFatal 是否严重错误

func (Error) IsNormal

func (e Error) IsNormal() bool

IsNormal 是否普通错误

Jump to

Keyboard shortcuts

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