commit | 127882ebf0b752d3c99fec3613c4487b193412e8 | [log] [tgz] |
---|---|---|
author | Abhinav Gupta <abg@uber.com> | Thu Sep 26 13:24:24 2019 -0700 |
committer | GitHub <noreply@github.com> | Thu Sep 26 13:24:24 2019 -0700 |
tree | b67cfb089b177b1fbb7ab1d5e650b09e9668b348 | |
parent | bd075f90b08f5274a0bc63bcffacd6c64b60ac55 [diff] |
Support errors.As and errors.Is (#28) Go 1.13 includes the `errors.As` and `errors.Is` APIs. The base functionality provided by these functions is to cast errors in an error chain to a specific type or check for equality. The only definition of error chain currently supported is via errors which return the underlying cause with a `Unwrap() error` method, but the design does not make any assumptions otherwise. Specifically, both, `errors.As` and `errors.Is` support customizing their behavior by implementing, interface { As(interface{}) bool } interface { Is(error) bool } This change does exactly that, making it possible to extract or match against individual errors in a multierr error. This will work for both, top-level errors in a multierr error, as well as for errors wrapped by any of those errors.
multierr
allows combining one or more Go error
s together.
go get -u go.uber.org/multierr
Stable: No breaking changes will be made before 2.0.
Released under the MIT License.