Documentation ¶
Index ¶
- Constants
- func IsConflictError(err error) bool
- func IsNotFoundError(err error) bool
- type APIException
- func NewAPIException(namespace string, code int, reason, format string, a ...interface{}) APIException
- func NewAccessTokenExpired(format string, a ...interface{}) APIException
- func NewAccessTokenIllegal(format string, a ...interface{}) APIException
- func NewBadRequest(format string, a ...interface{}) APIException
- func NewConflict(format string, a ...interface{}) APIException
- func NewInternalServerError(format string, a ...interface{}) APIException
- func NewNotFound(format string, a ...interface{}) APIException
- func NewOtherClientsLoggedIn(format string, a ...interface{}) APIException
- func NewOtherIPLoggedIn(format string, a ...interface{}) APIException
- func NewOtherPlaceLoggedIn(format string, a ...interface{}) APIException
- func NewPasswordExired(format string, a ...interface{}) APIException
- func NewPasswordReset(format string, a ...interface{}) APIException
- func NewPermissionDeny(format string, a ...interface{}) APIException
- func NewRefreshTokenExpired(format string, a ...interface{}) APIException
- func NewRefreshTokenIllegal(format string, a ...interface{}) APIException
- func NewSessionTerminated(format string, a ...interface{}) APIException
- func NewUnauthorized(format string, a ...interface{}) APIException
- type Namespace
Constants ¶
View Source
const ( // OtherPlaceLoggedIn 登录登录 OtherPlaceLoggedIn = 50010 // OtherIPLoggedIn 异常IP登录 OtherIPLoggedIn = 50011 // OtherClientsLoggedIn 用户已经通过其他端登录 OtherClientsLoggedIn = 50012 // SessionTerminated 会话中断 SessionTerminated = 50013 // AccessTokenExpired token过期 AccessTokenExpired = 50014 // RefreshTokenExpired token过期 RefreshTokenExpired = 50015 // AccessTokenIllegal 访问token不合法 AccessTokenIllegal = 50016 // RefreshTokenIllegal 刷新token不合法 RefreshTokenIllegal = 50017 // PasswordExpired 密码过期 PasswordExpired = 50018 // PasswordReset 密码需要重置 PasswordReset = 50019 Unauthorized = http.StatusUnauthorized // BadRequest 请求不合法 BadRequest = http.StatusBadRequest // InternalServerError 服务端内部错误 InternalServerError = http.StatusInternalServerError // Forbidden 无权限 Forbidden = http.StatusForbidden // NotFound 接口未找到 NotFound = http.StatusNotFound // Conflict 资源冲突, 已经存在 Conflict = http.StatusConflict // UnKnownException 未知异常 UnKnownException = 99999 )
View Source
const ( // GlobalNamespace 所有服务公用的一些异常 GlobalNamespace = Namespace("global") )
Variables ¶
This section is empty.
Functions ¶
func IsConflictError ¶ added in v0.4.2
IsConflictError 判断是否是Conflict
Types ¶
type APIException ¶
type APIException interface { error ErrorCode() int WithMeta(m interface{}) APIException Meta() interface{} WithData(d interface{}) APIException Data() interface{} Is(code int) bool Namespace() string Reason() string }
APIException API异常
func NewAPIException ¶
func NewAPIException(namespace string, code int, reason, format string, a ...interface{}) APIException
NewAPIException 创建一个API异常 用于其他模块自定义异常
func NewAccessTokenExpired ¶ added in v0.1.2
func NewAccessTokenExpired(format string, a ...interface{}) APIException
NewAccessTokenExpired 访问token过期
func NewAccessTokenIllegal ¶ added in v0.2.1
func NewAccessTokenIllegal(format string, a ...interface{}) APIException
NewAccessTokenIllegal 访问token过期
func NewBadRequest ¶
func NewBadRequest(format string, a ...interface{}) APIException
NewBadRequest todo
func NewConflict ¶ added in v0.4.2
func NewConflict(format string, a ...interface{}) APIException
NewConflict todo
func NewInternalServerError ¶
func NewInternalServerError(format string, a ...interface{}) APIException
NewInternalServerError 500
func NewOtherClientsLoggedIn ¶ added in v0.2.1
func NewOtherClientsLoggedIn(format string, a ...interface{}) APIException
NewOtherClientsLoggedIn 其他端登录
func NewOtherIPLoggedIn ¶ added in v0.4.9
func NewOtherIPLoggedIn(format string, a ...interface{}) APIException
NewOtherIPLoggedIn 异常IP登录
func NewOtherPlaceLoggedIn ¶ added in v0.4.9
func NewOtherPlaceLoggedIn(format string, a ...interface{}) APIException
NewOtherPlaceLoggedIn 异地登录
func NewPasswordExired ¶ added in v0.5.2
func NewPasswordExired(format string, a ...interface{}) APIException
NewPasswordExired todo
func NewPasswordReset ¶ added in v0.5.5
func NewPasswordReset(format string, a ...interface{}) APIException
NewPasswordReset todo
func NewPermissionDeny ¶
func NewPermissionDeny(format string, a ...interface{}) APIException
NewPermissionDeny 没有权限访问
func NewRefreshTokenExpired ¶ added in v0.1.2
func NewRefreshTokenExpired(format string, a ...interface{}) APIException
NewRefreshTokenExpired 刷新token过期
func NewRefreshTokenIllegal ¶ added in v0.2.1
func NewRefreshTokenIllegal(format string, a ...interface{}) APIException
NewRefreshTokenIllegal 访问token过期
func NewSessionTerminated ¶ added in v0.4.9
func NewSessionTerminated(format string, a ...interface{}) APIException
NewSessionTerminated 会话结束
func NewUnauthorized ¶
func NewUnauthorized(format string, a ...interface{}) APIException
NewUnauthorized 未认证
Click to show internal directories.
Click to hide internal directories.