From 859721bd770a5a0eba196813b643d95dc0c181cc Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Sun, 15 Jun 2025 19:12:24 +0800 Subject: [PATCH] review: rewrite error messages from the end-user perspective Signed-off-by: Carlos Lima --- pkg/action/action.go | 4 ++-- pkg/action/action_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/action/action.go b/pkg/action/action.go index 643dddc45..4c028df5f 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -133,7 +133,7 @@ func annotateAndMerge(files map[string]string) (string, error) { func splitAndDeannotate(postrendered string) (map[string]string, error) { manifests, err := kio.ParseAll(postrendered) if err != nil { - return nil, fmt.Errorf("re-parsing merged buffer: %w", err) + return nil, fmt.Errorf("error parsing YAML: %w", err) } manifestsByFilename := make(map[string][]*kyaml.RNode) @@ -254,7 +254,7 @@ func (cfg *Configuration) renderResources(ch *chart.Chart, values chartutil.Valu // Use the file list and contents received from the post renderer if files, err = splitAndDeannotate(postRendered.String()); err != nil { - return hs, b, notes, fmt.Errorf("error while parsing post rendered files: %w", err) + return hs, b, notes, fmt.Errorf("error while parsing post rendered output: %w", err) } } diff --git a/pkg/action/action_test.go b/pkg/action/action_test.go index 401451a42..892c4c226 100644 --- a/pkg/action/action_test.go +++ b/pkg/action/action_test.go @@ -675,7 +675,7 @@ data: { name: "invalid yaml input", input: "invalid: yaml: content:", - expectedError: "re-parsing merged buffer", + expectedError: "error parsing YAML: MalformedYAMLError", }, { name: "manifest without filename annotation", @@ -885,7 +885,7 @@ func TestRenderResources_PostRenderer_SplitError(t *testing.T) { ) assert.Error(t, err) - assert.Contains(t, err.Error(), "error while parsing post rendered files") + assert.Contains(t, err.Error(), "error while parsing post rendered output: error parsing YAML: MalformedYAMLError:") } func TestRenderResources_PostRenderer_Integration(t *testing.T) {