Documentation
¶
Overview ¶
Package errors is a simple error wrapping package that automatically adds source locations to errors. It has the same API as github.com/pkg/errors but is much lighter weight.
If the envar "DEBUG=1" is true, any errors from this package that are printed will display <file>:<line> annotations at each wrapping location.
Index ¶
- Variables
- func As(err error, target any) bool
- func Errorf(format string, args ...any) error
- func Innermost(err error) bool
- func Is(err, target error) bool
- func Join(errs ...error) error
- func New(message string) error
- func Unwrap(err error) error
- func UnwrapAll(err error) []error
- func WithStack(err error) error
- func Wrap(err error, message string) error
- func Wrapf(err error, format string, args ...any) error
Constants ¶
This section is empty.
Variables ¶
var Debug = os.Getenv("DEBUG") != ""
Debug is set by the envar "$DEBUG" but may be overridden.
Functions ¶
func Join ¶
Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string.
func UnwrapAll ¶
UnwrapAll recursively unwraps all errors in err, including all intermediate errors.
Types ¶
This section is empty.