errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LevelNormal = 1
	LevelFatal  = 2
)

错误级别

View Source
const (
	ErrorCodeRouter = 10001
)

错误码

Variables

This section is empty.

Functions

func Fatal

func Fatal(code int, msg string) error

Fatal 新建严重错误

func New

func New(code int, msg string) error

New 新建普通错误

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