Documentation ¶
Index ¶
- Constants
- func IsNotFoundError(err error) bool
- type APIException
- func NewAccessTokenExpired(format string, a ...interface{}) APIException
- func NewBadRequest(format string, a ...interface{}) APIException
- func NewInternalServerError(format string, a ...interface{}) APIException
- func NewNotFound(format string, a ...interface{}) APIException
- func NewPermissionDeny(format string, a ...interface{}) APIException
- func NewRefreshTokenExpired(format string, a ...interface{}) APIException
- func NewUnauthorized(format string, a ...interface{}) APIException
- type Namespace
- type WithAPIException
Constants ¶
View Source
const ( // AccessTokenExpired token过期 AccessTokenExpired = 1000 // RefreshTokenExpired token过期 RefreshTokenExpired = 1001 // 1xx - 5xx copy from http status code BadRequest = http.StatusBadRequest InternalServerError = http.StatusInternalServerError Forbidden = http.StatusForbidden NotFound = http.StatusNotFound UnKnownException = 9999 )
View Source
const ( // GlobalNamespace 所有服务公用的一些异常 GlobalNamespace = Namespace("global") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIException ¶
type APIException interface { error ErrorCode() int Meta() interface{} Is(code int) bool Namespace() string Reason() string }
APIException API异常
func NewAccessTokenExpired ¶ added in v0.1.2
func NewAccessTokenExpired(format string, a ...interface{}) APIException
NewAccessTokenExpired 访问token过期
func NewBadRequest ¶
func NewBadRequest(format string, a ...interface{}) APIException
NewBadRequest todo
func NewInternalServerError ¶
func NewInternalServerError(format string, a ...interface{}) APIException
NewInternalServerError 500
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 NewUnauthorized ¶
func NewUnauthorized(format string, a ...interface{}) APIException
NewUnauthorized 未认证
type WithAPIException ¶
type WithAPIException interface { APIException WithMeta(m interface{}) APIException }
WithAPIException 携带元信息的异常
func NewAPIException ¶
func NewAPIException(namespace string, code int, reason, format string, a ...interface{}) WithAPIException
NewAPIException 创建一个API异常 用于其他模块自定义异常
Click to show internal directories.
Click to hide internal directories.