Documentation ¶
Index ¶
- Variables
- type ErrorX
- func (e *ErrorX) Clone() *ErrorX
- func (e *ErrorX) Error() string
- func (e *ErrorX) ForceMsg(msg string) *ErrorX
- func (e *ErrorX) ForceMsgF(format string, a ...interface{}) *ErrorX
- func (e *ErrorX) ForceNew(code int64, message string, httpCode int, rpcCode gcodes.Code, ...) *ErrorX
- func (e *ErrorX) GetCode() int64
- func (e *ErrorX) GetDetails() []string
- func (e *ErrorX) GetHttpCode() int
- func (e *ErrorX) GetMsg() string
- func (e *ErrorX) GetRpcCode() gcodes.Code
- func (e *ErrorX) WithDetails(details ...string) *ErrorX
- func (e *ErrorX) WithDetailsF(format string, details ...interface{}) *ErrorX
- func (e *ErrorX) WithHttpCode(httpCode int) *ErrorX
- func (e *ErrorX) WithRpcCode(rpcCode gcodes.Code) *ErrorX
- type Status
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Success = New(0, "成功", http.StatusOK, gcodes.OK) ServerError = New(50000, "服务器繁忙", http.StatusInternalServerError, gcodes.Internal) InvalidRequest = New(40000, "无效请求", http.StatusBadRequest, gcodes.InvalidArgument) Unauthenticated = New(40001, "未登录", http.StatusUnauthorized, gcodes.Unauthenticated) UnauthenticatedTokenTimeout = New(40002, "token超时", http.StatusUnauthorized, gcodes.Unauthenticated) UnauthenticatedTokenInvalid = New(40003, "无效token", http.StatusUnauthorized, gcodes.Unauthenticated) Forbidden = New(40004, "无权操作", http.StatusForbidden, gcodes.PermissionDenied) NotFound = New(40005, "无效数据", http.StatusNotFound, gcodes.NotFound) InvalidParams = New(40006, "请求参数错误", http.StatusBadRequest, gcodes.InvalidArgument) DuplicateRequest = New(40007, "重复请求", http.StatusBadRequest, gcodes.InvalidArgument) BusinessError = New(40008, "业务错误", http.StatusBadRequest, gcodes.InvalidArgument) ImportError = New(40009, "导入错误", http.StatusBadRequest, gcodes.InvalidArgument) UserNotBind = New(40010, "未绑定用户", http.StatusBadRequest, gcodes.InvalidArgument) ThirdPartyUserMissing = New(40011, "无法找到之前存在系统的第三方用户", http.StatusBadRequest, gcodes.InvalidArgument) MissingActivityID = New(40012, "无效活动", http.StatusBadRequest, gcodes.InvalidArgument) VailSign = New(40013, "验签失败", http.StatusBadRequest, gcodes.InvalidArgument) DataNotFound = New(40014, "数据查询失败", http.StatusBadRequest, gcodes.InvalidArgument) DataStoreFail = New(40015, "数据新增失败", http.StatusBadRequest, gcodes.InvalidArgument) DataUpdateFail = New(40016, "数据更新失败", http.StatusBadRequest, gcodes.InvalidArgument) DataDestroyFail = New(40017, "数据删除失败", http.StatusBadRequest, gcodes.InvalidArgument) HandleFail = New(40018, "操作失败,请稍后重试", http.StatusBadRequest, gcodes.InvalidArgument) InvalidToken = New(40019, "无效token", http.StatusBadRequest, gcodes.InvalidArgument) InvalidVerificationCode = New(40020, "验证码错误", http.StatusBadRequest, gcodes.InvalidArgument) PermissionDenied = New(40021, "权限不足", http.StatusBadRequest, gcodes.InvalidArgument) UserNotFound = New(40022, "用户不存在", http.StatusBadRequest, gcodes.InvalidArgument) WrongTimestamp = New(40023, "时间戳错误", http.StatusBadRequest, gcodes.InvalidArgument) WrongSign = New(40024, "签名错误", http.StatusBadRequest, gcodes.InvalidArgument) DownloadFail = New(40025, "下载失败", http.StatusBadRequest, gcodes.InvalidArgument) Unknown = New(40902, "未知错误", http.StatusConflict, gcodes.Unknown) AnyError = New(-1, "", http.StatusBadRequest, gcodes.Unknown) // be used to set self make err, DO NOT suggest to use this !!! )
Functions ¶
This section is empty.
Types ¶
type ErrorX ¶
type ErrorX struct {
// contains filtered or unexported fields
}
func (*ErrorX) ForceNew ¶
func (e *ErrorX) ForceNew(code int64, message string, httpCode int, rpcCode gcodes.Code, details []string) *ErrorX
DO NOT suggest to use this to change original msg !!!
func (*ErrorX) GetDetails ¶
func (*ErrorX) GetRpcCode ¶
return this errorX bind rpc code
func (*ErrorX) WithDetails ¶
return a new errorX with details
func (*ErrorX) WithDetailsF ¶
return a new errorX with detailsF
func (*ErrorX) WithHttpCode ¶
return a new errorX with http code
Click to show internal directories.
Click to hide internal directories.