code

package
v1.5.37 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 0 Imported by: 0

README

错误码规则

  • 错误码需在 code 包中进行定义。
错误码为 5 位数
1 01 01
服务级错误码 模块级错误码 具体错误码
  • 服务级错误码:1 位数进行表示,比如 1 为系统级错误;2 为普通错误,通常是由用户非法操作引起。
  • 模块级错误码:2 位数进行表示,比如 01 为用户模块;02 为订单模块。
  • 具体的错误码:2 位数进行表示,比如 01 为手机号不合法;02 为验证码输入错误。

Documentation

Index

Constants

View Source
const (
	Crash_Error        = -1    //代码错误
	SUCCESS_CODE       = 0     //成功的状态码
	Token_Error        = 4     //Token错误
	BAD_LOGIN          = 10000 //登录失败
	BUSINESS_ERR       = 10001 //业务错误
	BAD_REQUEST        = 10002 //参数错误
	PERMISSION_ERR     = 10003 //权限校验错误
	NULL_ERR           = 10004 //无数据错误
	CACHE_ERR          = 10005 //缓存异常
	NoMethod_ERR       = 10006
	DATABASE_ERR       = 10007 //数据库异常
	ServerError        = 10101
	TooManyRequests    = 10102
	ParamBindError     = 10103
	AuthorizationError = 10104
	UrlSignError       = 10105
	CacheSetError      = 10106
	CacheGetError      = 10107
	CacheDelError      = 10108
	CacheNotExist      = 10109
	ResubmitError      = 10110
	HashIdsEncodeError = 10111
	HashIdsDecodeError = 10112
	RBACError          = 10113
	RedisConnectError  = 10114
	MySQLConnectError  = 10115
	WriteConfigError   = 10116
	SendEmailError     = 10117
	MySQLExecError     = 10118
	GoVersionError     = 10119

	AuthorizedCreateError    = 20101
	AuthorizedListError      = 20102
	AuthorizedDeleteError    = 20103
	AuthorizedUpdateError    = 20104
	AuthorizedDetailError    = 20105
	AuthorizedCreateAPIError = 20106
	AuthorizedListAPIError   = 20107
	AuthorizedDeleteAPIError = 20108

	AdminCreateError             = 20201
	AdminListError               = 20202
	AdminDeleteError             = 20203
	AdminUpdateError             = 20204
	AdminResetPasswordError      = 20205
	AdminLoginError              = 20206
	AdminLogOutError             = 20207
	AdminModifyPasswordError     = 20208
	AdminModifyPersonalInfoError = 20209
	AdminMenuListError           = 20210
	AdminMenuCreateError         = 20211
	AdminOfflineError            = 20212
	AdminDetailError             = 20213

	MenuCreateError       = 20301
	MenuUpdateError       = 20302
	MenuListError         = 20303
	MenuDeleteError       = 20304
	MenuDetailError       = 20305
	MenuCreateActionError = 20306
	MenuListActionError   = 20307
	MenuDeleteActionError = 20308
)

Variables

This section is empty.

Functions

func Text

func Text(code int) string

Types

type Failure

type Failure struct {
	Code    int    `json:"code"`    // 业务码
	Message string `json:"message"` // 描述信息
}

Failure 错误时返回结构

Jump to

Keyboard shortcuts

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