diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-06-23 13:05:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 13:05:31 -0400 |
commit | 7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c (patch) | |
tree | b8d6e6c38c0efa5b48743b2b4e8bd96c3f7398c4 /pkg/errorhandling | |
parent | 3322ea2c68e1bac86748534615fd35c19bc0a655 (diff) | |
parent | 5fc622f945de46db85c8cc0284f935bac1929e3a (diff) | |
download | podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.tar.gz podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.tar.bz2 podman-7ed18eaec6a3ad6aff45cec79fdb15e7ffb6396c.zip |
Merge pull request #10739 from vrothberg/fix-10682
create: support images with invalid platform
Diffstat (limited to 'pkg/errorhandling')
-rw-r--r-- | pkg/errorhandling/errorhandling.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go index 9b1740006..6adbc9f34 100644 --- a/pkg/errorhandling/errorhandling.go +++ b/pkg/errorhandling/errorhandling.go @@ -15,6 +15,12 @@ func JoinErrors(errs []error) error { return nil } + // If there's just one error, return it. This prevents the "%d errors + // occurred:" header plus list from the multierror package. + if len(errs) == 1 { + return errs[0] + } + // `multierror` appends new lines which we need to remove to prevent // blank lines when printing the error. var multiE *multierror.Error @@ -24,9 +30,6 @@ 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())) } |