diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-15 01:37:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-15 01:37:19 +0100 |
commit | 12aa9caf97bdcb6dc71a8c94c4875f9e0e87022a (patch) | |
tree | f0dc54d0ff39dc1f5ad56ecf8619f47ea7f22771 /vendor/github.com/pkg/errors/errors.go | |
parent | 0aa9dba3e1009dbbdf59d47d9370db0de4679730 (diff) | |
parent | f5bda9994d5e6cb1ee42ade5e7786059feedf633 (diff) | |
download | podman-12aa9caf97bdcb6dc71a8c94c4875f9e0e87022a.tar.gz podman-12aa9caf97bdcb6dc71a8c94c4875f9e0e87022a.tar.bz2 podman-12aa9caf97bdcb6dc71a8c94c4875f9e0e87022a.zip |
Merge pull request #4866 from TomSweeneyRedHat/dev/tsweeney/buildah1.13.1
Bump to Buildah v1.13.1
Diffstat (limited to 'vendor/github.com/pkg/errors/errors.go')
-rw-r--r-- | vendor/github.com/pkg/errors/errors.go | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go index 7421f326f..a9840ecee 100644 --- a/vendor/github.com/pkg/errors/errors.go +++ b/vendor/github.com/pkg/errors/errors.go @@ -82,7 +82,7 @@ // // if err, ok := err.(stackTracer); ok { // for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d", f) +// fmt.Printf("%+s:%d\n", f, f) // } // } // @@ -159,6 +159,9 @@ type withStack struct { func (w *withStack) Cause() error { return w.error } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withStack) Unwrap() error { return w.error } + func (w *withStack) Format(s fmt.State, verb rune) { switch verb { case 'v': @@ -241,6 +244,9 @@ type withMessage struct { func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } func (w *withMessage) Cause() error { return w.cause } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withMessage) Unwrap() error { return w.cause } + func (w *withMessage) Format(s fmt.State, verb rune) { switch verb { case 'v': @@ -254,29 +260,3 @@ func (w *withMessage) Format(s fmt.State, verb rune) { io.WriteString(s, w.Error()) } } - -// Cause returns the underlying cause of the error, if possible. -// An error value has a cause if it implements the following -// interface: -// -// type causer interface { -// Cause() error -// } -// -// If the error does not implement Cause, the original error will -// be returned. If the error is nil, nil will be returned without further -// investigation. -func Cause(err error) error { - type causer interface { - Cause() error - } - - for err != nil { - cause, ok := err.(causer) - if !ok { - break - } - err = cause.Cause() - } - return err -} |