summaryrefslogtreecommitdiff
path: root/pkg/errorhandling/errorhandling.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-05 09:20:16 -0400
committerGitHub <noreply@github.com>2021-05-05 09:20:16 -0400
commita278195af3423f882c1f5bb218792f7c2ce10a3c (patch)
tree192e52054de2abf0c92d83ecdbc71d498c2ec947 /pkg/errorhandling/errorhandling.go
parent8eefca5a257121b177562742c972e39e1686140d (diff)
parent0f7d54b0260c1be992ee3b9cee359ef3a9e8bd21 (diff)
downloadpodman-a278195af3423f882c1f5bb218792f7c2ce10a3c.tar.gz
podman-a278195af3423f882c1f5bb218792f7c2ce10a3c.tar.bz2
podman-a278195af3423f882c1f5bb218792f7c2ce10a3c.zip
Merge pull request #10147 from vrothberg/new-image-package
migrate Podman to containers/common/libimage
Diffstat (limited to 'pkg/errorhandling/errorhandling.go')
-rw-r--r--pkg/errorhandling/errorhandling.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go
index 9dc545ebb..9b1740006 100644
--- a/pkg/errorhandling/errorhandling.go
+++ b/pkg/errorhandling/errorhandling.go
@@ -33,6 +33,9 @@ func JoinErrors(errs []error) error {
// ErrorsToString converts the slice of errors into a slice of corresponding
// error messages.
func ErrorsToStrings(errs []error) []string {
+ if len(errs) == 0 {
+ return nil
+ }
strErrs := make([]string, len(errs))
for i := range errs {
strErrs[i] = errs[i].Error()
@@ -43,6 +46,9 @@ func ErrorsToStrings(errs []error) []string {
// StringsToErrors converts a slice of error messages into a slice of
// corresponding errors.
func StringsToErrors(strErrs []string) []error {
+ if len(strErrs) == 0 {
+ return nil
+ }
errs := make([]error, len(strErrs))
for i := range strErrs {
errs[i] = errors.New(strErrs[i])