From a94f9f6d1a69d0d10aa20253691f45317e69c3e3 Mon Sep 17 00:00:00 2001 From: Haitham Rageh Date: Wed, 16 Oct 2024 08:49:11 +0300 Subject: [PATCH] modify error handling in FindAllStackConfigsInPathsForSt (#726) Co-authored-by: Andriy Knysh --- pkg/config/utils.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/config/utils.go b/pkg/config/utils.go index 4bbf6b334..bd916b2bb 100644 --- a/pkg/config/utils.go +++ b/pkg/config/utils.go @@ -40,9 +40,13 @@ func FindAllStackConfigsInPathsForStack( // TODO: review `doublestar` library matches, err = u.GetGlobMatches(pathWithExt) if err != nil { - y, _ := u.ConvertToYAML(cliConfig) - return nil, nil, false, fmt.Errorf("%v\n\n\nCLI config:\n\n%v", err, y) + if cliConfig.Logs.Level == u.LogLevelTrace { + y, _ := u.ConvertToYAML(cliConfig) + return nil, nil, false, fmt.Errorf("%v\n\n\nCLI config:\n\n%v", err, y) + } + return nil, nil, false, err } + } // Exclude files that match any of the excludePaths @@ -118,8 +122,11 @@ func FindAllStackConfigsInPaths( // TODO: review `doublestar` library matches, err = u.GetGlobMatches(pathWithExt) if err != nil { - y, _ := u.ConvertToYAML(cliConfig) - return nil, nil, fmt.Errorf("%v\n\n\nCLI config:\n\n%v", err, y) + if cliConfig.Logs.Level == u.LogLevelTrace { + y, _ := u.ConvertToYAML(cliConfig) + return nil, nil, fmt.Errorf("%v\n\n\nCLI config:\n\n%v", err, y) + } + return nil, nil, err } }