codes

package
v0.0.0-...-70261f9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CodeInvalidParam       = 400
	CodeNoPerPermission    = 401 // 权限不足
	CodeInvalidRequest     = 404 // 非法请求
	CodeInvalidToken       = 406 // 无效的token
	CodeInternalError      = 500 // 内部错误
	CodeRequestToManyTimes = 601 // 操作频繁

	CodeMissingParameter = 404 //缺少参数
	CodeInvalidParameter = 404 //无效参数

	CodeRoleNoPerPermission = 403 //角色权限不足
	CodeForbiddenOperation  = 403 // 禁止操作
	CodeUserNotExist        = 404 // 用户不存在
	CodeUserAlreadyExist    = 405 // 用户已存在
	CodeSqlQuery            = 500 //数据库查询错误
	CodeCaptchaVerifyError  = 501 // 验证码错误
)

错误码定义规则 400-999 为系统类型错误与具体业务无关 1xxx 用户账号相关错误码 2xxx 会议室和设备相关错误码 3xxx 组织管理错误码

Variables

View Source
var (
	ErrorSqlQuery         = NewError(CodeSqlQuery, "数据库查询错误")
	ErrorUserUnLogin      = NewError(CodeForbiddenOperation, "用户未登录")
	ErrorCaptchaVerify    = NewError(CodeCaptchaVerifyError, "验证码错误")
	ErrorUserNotExist     = NewError(CodeUserNotExist, "用户不存在")
	ErrorUserAlreadyExist = NewError(CodeUserAlreadyExist, "用户已存在")
)

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(code int, msg string) *ApiError

func (*ApiError) Code

func (sel *ApiError) Code() int

func (*ApiError) Error

func (sel *ApiError) Error() string

func (*ApiError) IsCode

func (sel *ApiError) IsCode(c int) bool

func (*ApiError) IsErr

func (sel *ApiError) IsErr(err error) bool

func (*ApiError) Message

func (sel *ApiError) Message() string

func (*ApiError) Wrap

func (sel *ApiError) Wrap(err error) *ApiError

Jump to

Keyboard shortcuts

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