saError

package module
v0.0.0-...-c4991bf Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

error

介绍
  • 定义常用error code
  • 追踪调用文件及代码行数

Documentation

Index

Constants

View Source
const BeDisplayedErrorCode = 2000 //错误信息可以显示给用户
View Source
const ConflictErrorCode = 1106 //有冲突
View Source
const NormalErrorCode = 1000 //通常错误
View Source
const OutOfRange = 1105 //超出范围
View Source
const SensitiveErrorCode = 1001 //此类错误信息一般不对外暴露,可能会有一些敏感数据
View Source
const TooFrequentErrCode = 1010 //操作太频繁
View Source
const UnLoggedErrorCode = 1103 //未登录
View Source
const UnauthorizedErrorCode = 1104 //未授权

Variables

This section is empty.

Functions

func StackError

func StackError(err interface{}, params ...interface{}) error

会跟踪error的调用位置; err只接收字符串和error类型; params可传Code以及msg,注意:会覆盖前面的

Types

type Error

type Error struct {
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	Err    string `json:"err"`
	Caller string `json:"caller"`
}

func (*Error) Error

func (e *Error) Error() string

implements the error

func (*Error) String

func (e *Error) String() string

Jump to

Keyboard shortcuts

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