summaryrefslogtreecommitdiff
path: root/vendor/github.com/pkg/errors/errors.go
diff options
context:
space:
mode:
authorTomSweeneyRedHat <tsweeney@redhat.com>2020-01-14 14:46:46 -0500
committerTomSweeneyRedHat <tsweeney@redhat.com>2020-01-14 14:46:46 -0500
commitf5bda9994d5e6cb1ee42ade5e7786059feedf633 (patch)
tree4473a0c3b4615ee58165f06ccf57a1bfe4298fe9 /vendor/github.com/pkg/errors/errors.go
parent564bd693cae4e8a870be7a7860ef673e793f6358 (diff)
downloadpodman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.tar.gz
podman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.tar.bz2
podman-f5bda9994d5e6cb1ee42ade5e7786059feedf633.zip
Bump to Buildah v1.13.1
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'vendor/github.com/pkg/errors/errors.go')
-rw-r--r--vendor/github.com/pkg/errors/errors.go34
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
-}