Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // predefined global status, it can be override. OK = add(0, "ok") RequestErr = add(400, "错误请求") AccessDenied = add(403, "未授权访问") NothingFound = add(404, "页面不存在") MethodNotAllowed = add(405, "不支持该方法") LimitExceed = add(429, "请勿频繁请求") Canceled = add(498, "客户端取消请求") ServerErr = add(500, "网络错误,请稍后重试") Deadline = add(504, "服务调用超时") AppKeyInvalid = add(600, "应用程序不存在或已被封禁") SignCheckErr = add(601, "签名校验失败") RepeatedRequest = add(602, "重复请求") CaptchaErr = add(603, "验证码错误") TargetBlocked = add(604, "资源锁定中,请稍后重试") PayloadTooLarge = add(605, "请求体大小超出限制") ServiceUpdate = add(606, "系统升级中") UndefinedErr = add(1000, "未知错误") )
Functions ¶
func EqualError ¶ added in v1.0.0
EqualError check an err is a status error
Types ¶
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status represents an RPC status code, message, and details. It is immutable and should be created with New, Newf, or FromProto.
func ExtractContextStatus ¶
ExtractContextStatus converts a context error into a Status. It returns a Status with status.OK if err is nil, or a Status from errToStatus if err is non-nil and not a context error.
func (*Status) Details ¶
func (s *Status) Details() []interface{}
Details returns a slice of details messages attached to the status. If a detail cannot be decoded, the error is returned in place of the detail.
Click to show internal directories.
Click to hide internal directories.