mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 02:20:53 +00:00
improve the readability for multiple errors
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/pkg/errors"
|
||||
"sigs.k8s.io/kustomize/api/builtins"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
@@ -313,12 +314,18 @@ func (kt *KustTarget) accumulateResources(
|
||||
if errF := kt.accumulateFile(ra, path); errF != nil {
|
||||
ldr, errL := kt.ldr.New(path)
|
||||
if errL != nil {
|
||||
return nil, fmt.Errorf("accumulateFile %q, loader.New %q", errF, errL)
|
||||
return nil, multierror.Append(
|
||||
fmt.Errorf("accumulateFile error: %q", errF),
|
||||
fmt.Errorf("loader.New error: %q", errL),
|
||||
)
|
||||
}
|
||||
var errD error
|
||||
ra, errD = kt.accumulateDirectory(ra, ldr, false)
|
||||
if errD != nil {
|
||||
return nil, fmt.Errorf("accumulateFile %q, accumulateDirector: %q", errF, errD)
|
||||
return nil, multierror.Append(
|
||||
fmt.Errorf("accumulateFile error: %q", errF),
|
||||
fmt.Errorf("accumulateDirector error: %q", errD),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user