Documentation
¶
Overview ¶
Package wraperr packages an error with another wrapped error This allows errors.Is to work without directly injecting the string of the wrapped error
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WrapErr ¶
WrapErr wraps an underlying error with another error
Example usage:
var ErrLimit = errors.New("Limit reached")
...
func someFunc() error {
return wrapper.WrapErr{Err: fmt.Errorf("Limit %d reached on %s", limit, instance), Wrap: ErrLimit}
}
...
if errors.Is(err, ErrLimit) { ... }
This makes it easier to include a custom error message while also allowing
Click to show internal directories.
Click to hide internal directories.