Documentation ¶
Overview ¶
github.com/pkg/errors 包兼容函数
Index ¶
- func AppendCodes(codes ...xcode.XCode)
- func Errorf(format string, args ...interface{}) error
- func IsErrorCode(err error, code int) bool
- func IsXCode(err error, code xcode.XCode) bool
- func LoadCodes(codes ...xcode.XCode)
- func WithMessage(err error, message string) error
- func WithMessagef(err error, format string, args ...interface{}) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Error
- func (e *Error) Error() string
- func (e *Error) ErrorCode() int
- func (e *Error) GetFields() []interface{}
- func (e *Error) HttpStatus() int
- func (e *Error) String() string
- func (e *Error) ToMessage(config *ecode.Config) string
- func (e *Error) Unwrap() error
- func (e *Error) WithFields(field ...interface{})
- type XError
- func New(message string) XError
- func WithCode(code int, message string) XError
- func WithCodef(code int, format string, args ...interface{}) XError
- func WithXCode(code xcode.XCode) XError
- func WithXCodeMessage(code xcode.XCode, message string) XError
- func WithXCodeMessagef(code xcode.XCode, format string, args ...interface{}) XError
- func Wrap(err error, message string) XError
- func WrapWithCode(err error, code int) XError
- func WrapWithXCode(err error, code xcode.XCode) XError
- type XFields
- type XLoadCodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendCodes ¶
func IsErrorCode ¶
func WithMessage ¶
func WithMessagef ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) HttpStatus ¶
func (*Error) WithFields ¶
func (e *Error) WithFields(field ...interface{})
type XError ¶
type XError interface { // 获得错误的消息 // 该消息为其包裹的 `XCode` 的 `String()` 的返回值; // 如果没有包裹 `XCode`,则返回固定字符串 `error` String() string // 获得 error 栈消息 Error() string // 解包获得 error Unwrap() error // 获得错误的 HTTP STATUS HttpStatus() int // 获得错误码 ErrorCode() int // 将错误转成消息 ToMessage(config *ecode.Config) string }
func WithXCodeMessagef ¶
func WrapWithCode ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.