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.
4 files changed
tree: b67cfb089b177b1fbb7ab1d5e650b09e9668b348
  1. .codecov.yml
  2. .gitignore
  3. .travis.yml
  5. LICENSE.txt
  6. Makefile
  8. benchmarks_test.go
  9. error.go
  10. error_test.go
  11. example_test.go
  12. glide.lock
  13. glide.yaml
  14. go113.go
  15. go113_test.go
  16. scripts/

multierr GoDoc Build Status Coverage Status

multierr allows combining one or more Go errors together.


go get -u


Stable: No breaking changes will be made before 2.0.

Released under the MIT License.