Documentation ¶
Index ¶
- Constants
- func EqualError(srcCode, targetCode int64) bool
- func ErrorToJson(err Error) string
- func IsBaseError(err error) bool
- func IsBaseErrorCode(code int64) bool
- func IsDBError(err error) bool
- func IsInternalError(err error) bool
- func IsMessageError(err error) bool
- func IsNetError(err error) bool
- func IsNotFountError(err error) bool
- func IsRPCError(err error) bool
- func IsRedisErro(err error) bool
- func IsSystemError(err error) bool
- func NamedScope(name string) zap.Field
- type Error
- func BuildError(errorCode int64, message string) Error
- func ConverError(err error) Error
- func ConverUnknowError(err interface{}) Error
- func MessageError(message string) Error
- func NewNetError(err NetError) Error
- func ParseError(jsonStr string) Error
- func ParseErrorFromJSON(data []byte) Error
- func SystemError(message string) Error
- func WrappedError(errorCode int64, err error) Error
- func WrappedMessageError(err error) Error
- func WrappedSystemError(err error) Error
- type NetError
Constants ¶
View Source
const ( // 系统级别的错误,包括IO异常,空指针,等 ErrorSystem = _baseError | 0x1000000 // 业务相关的异常 ErrorMessage = _baseError | 0x2000000 ErrorMessageNotFount = ErrorMessage | 0x1 ErrorSystemInternal = ErrorSystem | 0x1 // ErrCodeScopeBaseRPC RPC级别的 ErrCode ErrorSystemDB = ErrorSystem | 0x2 ErrorSystemRedis = ErrorSystem | 0x3 // RPC错误,包含编解码 ErrorSystemRPC = ErrorSystem | 0x4 ErrorSystemNet = ErrorSystem | 0x5 )
Variables ¶
This section is empty.
Functions ¶
func EqualError ¶
func ErrorToJson ¶
func IsBaseError ¶
func IsBaseErrorCode ¶
func IsInternalError ¶
func IsMessageError ¶
func IsNetError ¶
func IsNotFountError ¶
func IsRPCError ¶
func IsRedisErro ¶
func IsSystemError ¶
func NamedScope ¶
Types ¶
type Error ¶
type Error interface { error GetCode() int64 GetFields(fields ...zap.Field) []zap.Field GetFieldsWithCause(fields ...zap.Field) []zap.Field FormatRPCError() string Is(Error) bool ToError() error }
Error 基础的错误接口
func BuildError ¶
func ConverError ¶
func ConverUnknowError ¶
func ConverUnknowError(err interface{}) Error
func MessageError ¶
func NewNetError ¶
func ParseError ¶
func ParseErrorFromJSON ¶
ParseErrorFromJSON 从 Jons数据解析出 Error 对象
func SystemError ¶
func WrappedError ¶
func WrappedMessageError ¶
func WrappedSystemError ¶
Click to show internal directories.
Click to hide internal directories.