Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StatusSuccess = NewGRPCStatus(0, "ok") StatusInvalidParams = NewGRPCStatus(10001, "参数错误") StatusInternalServerError = NewGRPCStatus(10003, "服务内部错误") StatusNotFound = NewGRPCStatus(10004, "资源不存在") StatusAlreadyExists = NewGRPCStatus(10005, "资源已存在") StatusTimeout = NewGRPCStatus(10006, "超时") StatusTooManyRequests = NewGRPCStatus(10007, "请求过多") StatusForbidden = NewGRPCStatus(10008, "拒绝访问") StatusLimitExceed = NewGRPCStatus(10009, "访问限制") StatusDeadlineExceeded = NewGRPCStatus(10010, "已超过最后期限") StatusAccessDenied = NewGRPCStatus(10011, "拒绝访问") StatusMethodNotAllowed = NewGRPCStatus(10012, "不允许使用的方法") )
nolint rpc系统级别错误码,有status前缀
View Source
var ( Success = NewError(0, "ok") InvalidParams = NewError(10001, "参数错误") InternalServerError = NewError(10003, "服务内部错误") NotFound = NewError(10004, "资源不存在") AlreadyExists = NewError(10005, "资源已存在") Timeout = NewError(10006, "超时") TooManyRequests = NewError(10007, "请求过多") Forbidden = NewError(10008, "拒绝访问") LimitExceed = NewError(10009, "访问限制") DeadlineExceeded = NewError(10010, "已超过最后期限") AccessDenied = NewError(10011, "拒绝访问") MethodNotAllowed = NewError(10012, "不允许使用的方法") )
nolint http系统级别错误码,无Err前缀
Functions ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error 错误
func (*Error) WithDetails ¶
WithDetails 携带附加错误详情
type GRPCStatus ¶
type GRPCStatus struct {
// contains filtered or unexported fields
}
GRPCStatus grpc 状态
func NewGRPCStatus ¶
func NewGRPCStatus(code codes.Code, msg string) *GRPCStatus
NewGRPCStatus 新建一个status
Click to show internal directories.
Click to hide internal directories.