summaryrefslogtreecommitdiff
path: root/pkg/errorhandling
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2021-04-14 13:38:27 -0400
committerNalin Dahyabhai <nalin@redhat.com>2021-04-14 13:45:36 -0400
commit9b3226a80a35ee85eebb6d910f9608dc301f0e72 (patch)
tree4d5d4074e7fdf9bd9a47bad4566f28728a4046ea /pkg/errorhandling
parent39a1f3a04f6128f7420c5c07ae98015131d0ece3 (diff)
downloadpodman-9b3226a80a35ee85eebb6d910f9608dc301f0e72.tar.gz
podman-9b3226a80a35ee85eebb6d910f9608dc301f0e72.tar.bz2
podman-9b3226a80a35ee85eebb6d910f9608dc301f0e72.zip
pkg/errorhandling.JoinErrors: don't throw away context for lone errors
When our multierror contains just one error, don't extract its text only to rewrap it, because doing so discards any stack trace information that might have been added closer to where the error actually originated. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'pkg/errorhandling')
-rw-r--r--pkg/errorhandling/errorhandling.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go
index b1923be98..9dc545ebb 100644
--- a/pkg/errorhandling/errorhandling.go
+++ b/pkg/errorhandling/errorhandling.go
@@ -24,6 +24,9 @@ func JoinErrors(errs []error) error {
if finalErr == nil {
return finalErr
}
+ if len(multiE.WrappedErrors()) == 1 && logrus.IsLevelEnabled(logrus.TraceLevel) {
+ return multiE.WrappedErrors()[0]
+ }
return errors.New(strings.TrimSpace(finalErr.Error()))
}