xerrors

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidInputError      = NewBizError(InvalidInput, "无效的输入参数")
	InvalidCredentialError = NewBizError(InvalidCredential, "用户名或密码错误")
	InvalidTokenError      = NewBizError(InvalidToken, "无效的token")
	RecordNotFoundError    = NewBizError(RecordNotFound, "数据不存在")
)

Functions

This section is empty.

Types

type BizError

type BizError struct {
	Code ErrorCode `json:"errCode"`
	Msg  string    `json:"errMsg"`
}

func NewBizError

func NewBizError(code ErrorCode, msg string, args ...interface{}) *BizError

func NewInvalidInputError

func NewInvalidInputError(msg string, args ...interface{}) *BizError

func (*BizError) Error

func (e *BizError) Error() string

type ErrorCode

type ErrorCode int
const (
	InvalidInput   ErrorCode = 10000 + iota // 输入异常
	InvalidToken                            // 无效的Token
	ValidateFailed                          // 数据校验异常
	RecordNotFound                          // 数据不存在

	InvalidCredential // 用户名或密码错误

	DBFailed = 10009

	Unknown = 99999
)

Jump to

Keyboard shortcuts

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