nerrors

package
v0.6.33 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: AGPL-3.0 Imports: 10 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//ErrUserNotLoggedIn 用户未登录
	ErrUserNotLoggedIn = echo.NewError(`User not logged in`, code.Unauthenticated)
	//ErrUserNotFound 用户不存在
	ErrUserNotFound = echo.NewError(`User does not exist`, code.UserNotFound)
	//ErrUserNoPerm 用户无权限
	ErrUserNoPerm = echo.NewError(`User has no permission`, code.NonPrivileged)
	//ErrUserDisabled 用户已被禁用
	ErrUserDisabled = echo.NewError(`User has been disabled`, code.UserDisabled)
	//ErrBalanceNoEnough 余额不足
	ErrBalanceNoEnough = echo.NewError(`Balance is not enough`, code.BalanceNoEnough)

	//ErrInvalidAppID App ID 无效
	ErrInvalidAppID = echo.NewError(`Invalid app id`, code.InvalidAppID)
	//ErrInvalidSign 无效签名
	ErrInvalidSign = echo.NewError(`Invalid sign`, code.InvalidSignature)
	//ErrInvalidToken 令牌无效
	ErrInvalidToken = echo.NewError(`Invalid token`, code.InvalidToken)

	//ErrCaptcha 验证码错误
	ErrCaptcha = captcha.ErrCaptcha
	//ErrCaptchaIdMissing 缺少captchaId
	ErrCaptchaIdMissing = captcha.ErrCaptchaIdMissing
	//ErrCaptchaCodeRequired 验证码不能为空
	ErrCaptchaCodeRequired = captcha.ErrCaptchaCodeRequired

	//ErrRepeatOperation 重复操作
	ErrRepeatOperation = echo.NewError(`Repeat operation`, code.RepeatOperation)
	//ErrUnsupported 不支持
	ErrUnsupported = echo.NewError(`Unsupported`, code.Unsupported)
	//ErrOperationTimeout 操作超时
	ErrOperationTimeout = echo.NewError(`Operation timeout`, code.OperationTimeout)
	//ErrOperationFail 操作失败
	ErrOperationFail = echo.NewError(`Operation fail`, code.Failure)

	//ErrResponseFormatError 响应格式错误
	ErrResponseFormatError = echo.NewError(`Response format error`, code.AbnormalResponse)
	//ErrRequestTimeout 提交超时
	ErrRequestTimeout = echo.NewError(`Request timeout`, code.RequestTimeout)
	//ErrRequestFail 提交失败
	ErrRequestFail = echo.NewError(`Request fail`, code.RequestFailure)

	// ErrIgnoreConfigChange 忽略配置文件更改
	ErrIgnoreConfigChange = errors.New(`Ignore configuration file changes`)

	// ErrNext 需要继续向下检查
	ErrNext            = errors.New("Next")
	ErrConcurrentLock  = errors.New("Concurrent lock has been triggered")
	ErrContextCanceled = errors.New("Context canceled")
)
View Source
var NewErrors = errorslice.New

Functions

func GetErr

func GetErr(key string) (err error)

func IsCaptchaErrCode

func IsCaptchaErrCode(code stdCode.Code) bool

IsCaptchaErrCode 是否验证码错误码

func IsCaptchaError

func IsCaptchaError(err error) bool

IsCaptchaError 用户验证码错误

func IsErr

func IsErr(err error, key string) bool

func IsError

func IsError(err interface{}) bool

IsError 是否是错误信息

func IsFailureCode

func IsFailureCode(code stdCode.Code) bool

func IsMessage

func IsMessage(err interface{}) bool

IsMessage 判断err是否为Message

func IsOk

func IsOk(err interface{}) bool

IsOk 是否是成功信息

func IsUserDisabled

func IsUserDisabled(err error) bool

IsUserDisabled 用户是否被禁用

func IsUserNoPerm

func IsUserNoPerm(err error) bool

IsUserNoPerm 用户是否没有操作权限

func IsUserNotFound

func IsUserNotFound(err error) bool

IsUserNotFound 用户是否不存在

func IsUserNotLoggedIn

func IsUserNotLoggedIn(err error) bool

IsUserNotLoggedIn 用户是否未登录

func JSONBytesParseError

func JSONBytesParseError(err error, jsonBytes []byte) error

func OkString

func OkString(err interface{}) string

OkString 获取成功信息

func RegisterErr

func RegisterErr(key string, err error)

Types

type ErrorTab

type ErrorTab interface {
	ErrorTab() string
}

type Errors

type Errors = errorslice.Errors

type Messager

type Messager interface {
	Successor
	error
}

Messager 信息接口

var DefaultNopMessage Messager = &NopMessage{}

DefaultNopMessage 默认空消息

func Message

func Message(err interface{}) Messager

Message 获取err中的信息接口

type NopMessage

type NopMessage struct {
}

NopMessage 空消息

func (*NopMessage) Error

func (n *NopMessage) Error() string

Error 错误信息

func (*NopMessage) String

func (n *NopMessage) String() string

String 信息字符串

func (*NopMessage) Success

func (n *NopMessage) Success() string

Success 成功信息

type Stringify

type Stringify interface {
	Stringify(separator string) string
}

type Success

type Success struct {
	Value string
}

Success 成功信息

func (*Success) String

func (s *Success) String() string

func (*Success) Success

func (s *Success) Success() string

Success 成功信息

type Successor

type Successor interface {
	Success() string
}

Successor 成功信息接口

func NewOk

func NewOk(v string) Successor

NewOk 创建成功信息

Jump to

Keyboard shortcuts

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