Documentation ¶
Index ¶
- func Code(err error) codes.Code
- func Error(c codes.Code, msg string) error
- func ErrorWithCause(c codes.Code, cause error, msg string) error
- func Errorf(c codes.Code, format string, a ...interface{}) error
- func ErrorfWithCause(c codes.Code, cause error, format string, a ...interface{}) error
- func ExtractErrCode(err error) (uint32, bool)
- type RpcError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
Code returns the Code of the error if it is a RpcError error, codes.OK if err is nil, or codes.Unknown otherwise.
func ErrorWithCause ¶
Error returns an error with cause and msg.
func ErrorfWithCause ¶
Error returns an error with cause and formatted msg.
func ExtractErrCode ¶
ExtractErrCode 从 error 消息中提取 uint32 的错误码
Types ¶
type RpcError ¶
type RpcError struct { Code codes.Code `json:"code"` // 错误码 Message string `json:"message"` // 额外的错误提示消息 Cause error `json:"cause"` // 导致本 error 的内部 error }
func (*RpcError) DetailedError ¶
func (*RpcError) GetMessage ¶
Click to show internal directories.
Click to hide internal directories.