Documentation
¶
Index ¶
- func As(err error, target interface{}) bool
- func Check(err error) error
- func CheckAny[R any](result R, err error) func(func(R) error) error
- func CheckAnyf[R any](result R, err error) func(func(R) error, string, ...any) error
- func Checkf(err error, msg string, params ...interface{}) error
- func Ignore[T any](r T, _ error) T
- func IgnoreCheckAny[R any]() func(R) error
- func Is(err, target error) bool
- func Must[T any](r T, err error) T
- func New(err error) error
- func Newf(format string, params ...interface{}) error
- func Newi(inner error, msg string) error
- func Newif(inner error, format string, params ...interface{}) error
- func Newm(msg string) error
- func News(skip int, err error) error
- func Newsf(skip int, format string, params ...interface{}) error
- func Newsi(skip int, inner error, msg string) error
- func Newsif(skip int, inner error, format string, params ...interface{}) error
- func Unwrap(err error) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAny ¶ added in v0.2.1
CheckAny is used for two return values function which also returns an error.
It calls the given function if the error is nil, otherwise it returns the error. Also returns the error returned by the given function.
This function is a shortcut for when you either return an error or handle a result as last statement in a function.
func CheckAnyf ¶ added in v0.2.3
CheckAnyf is used for two return values function which also returns an error.
It calls the given function if the error is nil, otherwise it returns the error. Also returns the error returned by the given function.
This function is a shortcut for when you either return an error or handle a result as last statement in a function.
func Checkf ¶ added in v0.2.3
Checkf returns error or nil. If error is not nil, it will be wrapped with the given message
func IgnoreCheckAny ¶ added in v0.2.1
Types ¶
type Error ¶
Error is a lightweight error struct with stack trace. Compatible with standard errors package.
Use NewXY functions to construct new errors.
func (*Error) StackTrace ¶
StackTrace builds the stack trace of all inner errors of Error