Documentation ¶
Index ¶
- Constants
- type APIException
- func NewAPIException(namespace string, code int, reason, format string, a ...interface{}) *APIException
- func NewBadRequest(format string, a ...interface{}) *APIException
- func NewNotFound(format string, a ...interface{}) *APIException
- func NewWebCookisNotFoundnRequest(format string, a ...interface{}) *APIException
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 // VerifyCodeRequired 需要验证码 VerifyCodeRequired = 50018 // PasswordExired 用户密码过期 PasswordExired = 50019 // cookis is not found for web 浏览器未发现cookis WebCookisNotFound = 50020 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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIException ¶
type APIException struct { Namespace string `json:"namespace"` HttpCode int `json:"http_code"` ErrCode int `json:"error_code"` Reason string `json:"reason"` Message string `json:"message"` Meta any `json:"meta"` Data any `json:"data"` }
APIException API异常
func NewAPIException ¶
func NewAPIException(namespace string, code int, reason, format string, a ...interface{}) *APIException
NewAPIException 创建一个API异常 用于其他模块自定义异常
func NewBadRequest ¶
func NewBadRequest(format string, a ...interface{}) *APIException
NewBadRequest todo a 的作用 "Resource not found: %s", "exampleID"
func NewNotFound ¶
func NewNotFound(format string, a ...interface{}) *APIException
NewNotFound todo a 的作用 "Resource not found: %s", "exampleID"
func NewWebCookisNotFoundnRequest ¶
func NewWebCookisNotFoundnRequest(format string, a ...interface{}) *APIException
NewWebCookisNotFoundnRequest todo a 的作用 "Resource not found: %s", "exampleID"
Click to show internal directories.
Click to hide internal directories.