Documentation ¶
Overview ¶
Package errors provides helpers for error creation, avoiding using different packages for errors.
e.g.:
import "github.com/ignite/cli/v28/ignite/pkg/errors" func main() { err1 := errors.New("error new") err2 := errors.Errorf("%s: error", foo) err3 := errors.Wrap(errFoo, errBar) }
Index ¶
- func As(err error, target interface{}) bool
- func Errorf(format string, args ...interface{}) error
- func Is(err, reference error) bool
- func Join(errs ...error) error
- func New(msg string) error
- func Unwrap(err error) error
- func WithStack(err error) error
- func Wrap(err error, msg string) error
- func Wrapf(err error, format string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
As finds the first error in err's chain that matches the type to which target points, and if so, sets the target to its value and returns true. An error matches a type if it is assignable to the target type, or if it has a method As(interface{}) bool such that As(target) returns true. As will panic if target is not a non-nil pointer to a type which implements error or is of interface type.
func Is ¶
Is determines whether one of the causes of the given error or any of its causes is equivalent to some reference error.
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.
Types ¶
This section is empty.