Documentation
¶
Index ¶
- func Cause(err error) error
- func Current(err error) error
- func Equal(err, target error) bool
- func HasError(err, target error) bool
- func HasStack(err error) bool
- func Is(err, target error) bool
- func New(text string) error
- func NewSkip(skip int, text string) error
- func NewSkipf(skip int, format string, args ...interface{}) error
- func Newf(format string, args ...interface{}) error
- func Stack(err error) string
- func Unwrap(err error) error
- func Wrap(err error, text string) error
- func WrapSkip(skip int, err error, text string) error
- func WrapSkipf(skip int, err error, format string, args ...interface{}) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Current ¶
Current creates and returns the current level error. It returns nil if current level error is nil.
func Equal ¶
Equal reports whether current error `err` equals to error `target`. Please note that, in default comparison logic for `Error`, the errors are considered the same if both the `code` and `text` of them are the same.
func Is ¶
Is reports whether current error `err` has error `target` in its chaining errors. It is just for implements for stdlib errors.Is from Go version 1.17.
func NewSkip ¶
NewSkip creates and returns an error which is formatted from given text. The parameter `skip` specifies the stack callers skipped amount.
func NewSkipf ¶
NewSkipf returns an error that formats as the given format and args. The parameter `skip` specifies the stack callers skipped amount.
func Stack ¶
Stack returns the stack callers as string. It returns the error string directly if the `err` does not support stacks.
func Unwrap ¶
Unwrap returns the next level error. It returns nil if current level error or the next level error is nil.
func Wrap ¶
Wrap wraps error with text. It returns nil if given err is nil. Note that it does not lose the error code of wrapped error, as it inherits the error code from it.
func WrapSkip ¶
WrapSkip wraps error with text. It returns nil if given err is nil. The parameter `skip` specifies the stack callers skipped amount. Note that it does not lose the error code of wrapped error, as it inherits the error code from it.
func WrapSkipf ¶
WrapSkipf wraps error with text that is formatted with given format and args. It returns nil if given err is nil. The parameter `skip` specifies the stack callers skipped amount. Note that it does not lose the error code of wrapped error, as it inherits the error code from it.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is custom error for additional features.
func (*Error) Current ¶
Current creates and returns the current level error. It returns nil if current level error is nil.
func (*Error) Equal ¶
Equal reports whether current error `err` equals to error `target`. Please note that, in default comparison for `Error`, the errors are considered the same if both the `code` and `text` of them are the same.