Documentation ¶
Index ¶
- Variables
- type BizErrorStruct
- type CustomError
- func NewBadRequestError(errCode string) *CustomError
- func NewCustomError(status int, code int, message string) *CustomError
- func NewForbiddenError(errCode string) *CustomError
- func NewInternalServerError(errCode string) *CustomError
- func NewNotFoundError(errCode string) *CustomError
- func NewUnauthorizedError(errCode string) *CustomError
Constants ¶
This section is empty.
Variables ¶
View Source
var BizErrorMap = map[string]BizErrorStruct{
"DEFAULT__BAD_REQUEST": {Code: 400, Message: "请求错误"},
"DEFAULT__UNAUTHORIZED": {Code: 401, Message: "需要登录"},
"DEFAULT__FORBIDDEN": {Code: 403, Message: "没有权限"},
"DEFAULT__NOT_FOUND": {Code: 404, Message: "资源不存在"},
"DEFAULT__RATE_LIMIT": {Code: 429, Message: "请求被限流"},
"DEFAULT__INTERNAL_ERROR": {Code: 500, Message: "内部错误"},
"TRACKER__INVALID_CLIENT": {Code: 1000, Message: "客户端不合法"},
"TRACKER__INVALID_PARAMS": {Code: 1001, Message: "请求参数不合法"},
"STATS__INVALID_PARAMS": {Code: 2000, Message: "请求参数不合法"},
}
Functions ¶
This section is empty.
Types ¶
type BizErrorStruct ¶
type CustomError ¶
func NewBadRequestError ¶
func NewBadRequestError(errCode string) *CustomError
func NewCustomError ¶
func NewCustomError(status int, code int, message string) *CustomError
func NewForbiddenError ¶
func NewForbiddenError(errCode string) *CustomError
func NewInternalServerError ¶
func NewInternalServerError(errCode string) *CustomError
func NewNotFoundError ¶
func NewNotFoundError(errCode string) *CustomError
func NewUnauthorizedError ¶
func NewUnauthorizedError(errCode string) *CustomError
func (*CustomError) Error ¶
func (e *CustomError) Error() string
func (*CustomError) Serialize ¶
func (e *CustomError) Serialize() map[string]interface{}
Click to show internal directories.
Click to hide internal directories.