Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = add(0) // 正确 NotModified = add(-304) // 木有改动 TemporaryRedirect = add(-307) // 撞车跳转 RequestErr = add(-400) // 请求错误 AccessDenied = add(-403) // 访问权限不足 NothingFound = add(-404) // 啥都木有 MethodNotAllowed = add(-405) // 不支持该方法 Conflict = add(-409) // 冲突 Canceled = add(-498) // 客户端取消请求 ServerErr = add(-500) // 服务器错误 Deadline = add(-504) // 服务调用超时 LimitExceed = add(-509) // 超出限制 )
All common ecode
View Source
var ( // Code CodeNotFound = New(100000) // 验证码未找到 CodeNotMatch = New(100001) // 验证码不匹配 // Token TokenNotFound = New(100010) // token未找到 TokenNotMatch = New(100011) // token不匹配 TokenInvalid = New(100012) // token不合法 TokenDelErr = New(100013) // token销毁失败 TokenAppIDDelErr = New(100014) // 登录的appIDs销毁失败 // AccessToken AccessTokenInvalid = New(100020) // access_token无效 AccessTokenExpired = New(100021) // access_token过期 // RefreshToken RefreshTokenInvalid = New(100030) // refresh_token无效 RefreshTokenExpired = New(100031) // refresh_token过期 // User UserNotFound = New(100100) // 用户未找到 UserNotMatch = New(100101) // 用户不匹配 UserNotLogin = New(100102) // 用户未登录 UserHasLogin = New(100103) // 用户已登录 UserIsBanned = New(100104) // 用户被关小黑屋 // Picture PicTooBig = New(100120) // 图片尺寸过大 PicExtErr = New(100201) // 图片格式错误 PicNotFound = New(100202) // 图片不存在 PicTooMuch = New(100204) // 图片要素过多 PicAbnormal = New(100205) // 图片违规 // App AppNotFound = New(100110) // 用户未找到 AppNotMatch = New(100111) // 用户不匹配 AppIsBanned = New(100112) // 用户被关小黑屋 // Illegal IllegalParam = New(200000) // 非法参数 IllegalName = New(200001) // 非法名称 IllegalURL = New(200002) // 非法URL IllegalDate = New(200003) // 非法日期 IllegalTime = New(200004) // 非法时间 IllegalGeo = New(200005) // 非法地理位置 IllegalTel = New(200006) // 非法电话号码 IllegalEmail = New(200007) // 非法邮箱格式 )
main ecode interval is [0,990000] [100000,100099] is about authentication [200000,200099] is about vertification [100100,199999] is used for all applications
Functions ¶
func EqualError ¶
EqualError checks if code equals to error
Types ¶
type Codes ¶
type Codes interface { // sometimes Error return Code in string form // NOTE: don't use Error in monitor report even it also work for now Error() string // Code get error code. Code() int // Message get code message. Message() string //Detail get error detail,it may be nil. Details() []interface{} }
Codes ecode error interface which has a code & message.
Click to show internal directories.
Click to hide internal directories.