Documentation
¶
Index ¶
- func As(err error, target interface{}) bool
- func Cause(err error) error
- func Code(err error) code.Code
- func Is(err, target error) bool
- func New(text string) error
- func NewError(args ...interface{}) error
- func Next(err error) error
- func Replace(err error, text string, condition ...code.Code) error
- func Stack(err error) *stack.Stack
- func Unwrap(err error) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewError ¶
func NewError(args ...interface{}) error
NewError 新建一个错误 可传入一下参数: text : 文本字符串 code : 错误码 error: 原生错误
Types ¶
type Error ¶
type Error interface {
error
// Is 返回当前错误是否等于目标错误
Is(target error) bool
// As 返回当前错误是否是某一类错误
As(target interface{}) bool
// Code 返回错误码
Code() code.Code
// Next 返回下一个错误
Next() error
// Cause 返回根因错误
Cause() error
// Stack 返回堆栈
Stack() *stack.Stack
// Replace 替换文本
Replace(text string, condition ...code.Code) error
}
Click to show internal directories.
Click to hide internal directories.