errcode

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessCode Err = 0
	ErrCode     Err = 1
	ModuleCode      = 100 * ErrCode
	ServerCode      = ModuleCode * 100
)

错误代码100101,其中 10 代表发布平台服务;中间的 01 代表发布平台服务下的文章模块;最后的 01 代表模块下的错误码序号,每个模块可以注册 100 个错误 0代表成功

View Source
const (
	HaSysCode  = 1 * ModuleCode //系统中产生的错误代码
	HaInitCode = 2 * ModuleCode //初始化模块
	HaUserCode = 3 * ModuleCode //用户信息模块
	HaLogCode  = 6 * ModuleCode //日志模块
)

模块代码

View Source
const (
	HaServer   = 10 * ServerCode // Ha管理平台
	AuthServer = 11 * ServerCode // 认证服务
)

服务平台

View Source
const (
	HaSysErr              = 1<<iota + HaServer + HaSysCode
	HaSysJsonMarshalErr   //转json失败
	HaSysJsonUnMarshalErr //json解析失败
	HaSysTimeParseErr     //时间转换错误
	HaSysParamErr         // 参数错误
)

系统运行中的错误

View Source
const (
	OperationFail = CommonCode + 100 + iota //操作失败
	ValueErr                                //参数错误
)
View Source
const (
	DBErr       = CommonCode + iota //数据库操作错误
	DBCreateErr                     //数据库操作错误
	DBFindErr                       //数据库查询错误
	DBUpdateErr
	DBDeleteErr
)

数据库类错误

View Source
const (
	UserNotFound  = CommonCode*2 + iota //用户不存在
	PasswordErr                         //用户名/密码错误
	MAXAdmin                            //已达最大用户数
	UserNameExist                       //用户已存在
	NoToken                             //未携带token
	TokenExpired                        //token过期
	RoleErr                             //权限错误
	ForbiddenErr                        //无权访问
	PwdErr                              //密码错误
	PwdMaxErr                           //密码错误次数过多已锁定
)

用户错误

View Source
const (
	UKeyNotExist       = 3*CommonCode + iota //UKey不存在
	UKeyOpenErr                              //UKey打开失败
	UKeySerialErr                            //UKey序列号错误
	UKeyUserNotFound                         //UKey用户不存在
	UKeyPwdErr                               //密码错误
	UKeyCertErr                              //证书错误
	UKeyParseErr                             //证书解析错误
	UKeyValidateErr                          //UKey认证失败
	UKeyUsernameErr                          //UKey用户名不匹配
	UKeyAddUsernameErr                       //UKey用户名不匹配
)

UKey错误

View Source
const (
	ThirdRequestErr = 4*CommonCode + iota
	TnaAuthErr
	UpdateFileErr     //升级包名称错误
	UpdateFileReadErr //升级包目录中文件读取错误
	UpdateFileLoadErr //升级包镜像导入错误
	UpdateAssistErr   // 请求助手升级失败
)

请求第三方

View Source
const (
	SysCacheErr         = 5*CommonCode + iota //缓存错误
	SysCacheGetErr                            //缓存获取错误
	SysCacheSetErr                            //缓存获取错误
	SysCmdErr                                 //执行宿主机cmd指令出错
	SysNetworkErr                             //配置网卡错误
	SysJsonMarshalErr                         //转json失败
	SysJsonUnMarshalErr                       //json解析失败
	SysTimeParseErr                           //时间转换错误
	SysSaveFileErr                            //保存文件错误
)

系统运行中的错误

View Source
const (
	IdCardErr       = 6*CommonCode + iota
	IdCardNumberErr //身份证号错误
)
View Source
const CommonCode = ErrCode * 1000

CommonCode 此处为通用错误代码4位

View Source
const (
	HaUserNotLogin = 1<<iota + HaServer + HaUserCode
)

Variables

View Source
var (
	ErrRecordNotFound = gorm.ErrRecordNotFound
	ErrKeyNotFound    = gcache.KeyNotFoundError
)

Functions

This section is empty.

Types

type Err

type Err int32

func (Err) Error added in v1.1.0

func (e Err) Error() string

Jump to

Keyboard shortcuts

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