From f4e72a0616fa79bfd3f4979dc32ce171effc2f1e Mon Sep 17 00:00:00 2001 From: monalisa Date: Mon, 11 Sep 2023 14:24:21 +0200 Subject: [PATCH 1/2] Use clearer error message when no interpolation value is found. --- bundle/config/interpolation/interpolation.go | 2 +- bundle/config/interpolation/interpolation_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundle/config/interpolation/interpolation.go b/bundle/config/interpolation/interpolation.go index bf5bd169ef..614f6f7c95 100644 --- a/bundle/config/interpolation/interpolation.go +++ b/bundle/config/interpolation/interpolation.go @@ -184,7 +184,7 @@ func (a *accumulator) Resolve(path string, seenPaths []string, fns ...LookupFunc // fetch the string node to resolve field, ok := a.strings[path] if !ok { - return fmt.Errorf("could not resolve reference %s", path) + return fmt.Errorf("no value found for interpolation query: ${%s}", path) } // return early if the string field has no variables to interpolate diff --git a/bundle/config/interpolation/interpolation_test.go b/bundle/config/interpolation/interpolation_test.go index 83254c9b0b..70b861a630 100644 --- a/bundle/config/interpolation/interpolation_test.go +++ b/bundle/config/interpolation/interpolation_test.go @@ -247,5 +247,5 @@ func TestInterpolationInvalidVariableReference(t *testing.T) { } err := expand(&config) - assert.ErrorContains(t, err, "could not resolve reference vars.foo") + assert.ErrorContains(t, err, "no value found for interpolation query: ${vars.foo}") } From ccc27c255438287389e60ae684cbbc0ea0672201 Mon Sep 17 00:00:00 2001 From: monalisa Date: Mon, 11 Sep 2023 14:29:10 +0200 Subject: [PATCH 2/2] - --- bundle/config/interpolation/interpolation.go | 2 +- bundle/config/interpolation/interpolation_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundle/config/interpolation/interpolation.go b/bundle/config/interpolation/interpolation.go index 614f6f7c95..8ba0b8b1ff 100644 --- a/bundle/config/interpolation/interpolation.go +++ b/bundle/config/interpolation/interpolation.go @@ -184,7 +184,7 @@ func (a *accumulator) Resolve(path string, seenPaths []string, fns ...LookupFunc // fetch the string node to resolve field, ok := a.strings[path] if !ok { - return fmt.Errorf("no value found for interpolation query: ${%s}", path) + return fmt.Errorf("no value found for interpolation reference: ${%s}", path) } // return early if the string field has no variables to interpolate diff --git a/bundle/config/interpolation/interpolation_test.go b/bundle/config/interpolation/interpolation_test.go index 70b861a630..cccb6dc718 100644 --- a/bundle/config/interpolation/interpolation_test.go +++ b/bundle/config/interpolation/interpolation_test.go @@ -247,5 +247,5 @@ func TestInterpolationInvalidVariableReference(t *testing.T) { } err := expand(&config) - assert.ErrorContains(t, err, "no value found for interpolation query: ${vars.foo}") + assert.ErrorContains(t, err, "no value found for interpolation reference: ${vars.foo}") }