Use clearer error message when no interpolation value is found. (#764)

## Changes
This PR makes the error message clearer for when interpolation fails. 

## Tests
Existing unit test and manually
This commit is contained in:
shreyas-goenka 2023-09-11 17:23:25 +02:00 committed by GitHub
parent 44726d6444
commit 373f441eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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 reference: ${%s}", path)
}
// return early if the string field has no variables to interpolate

View File

@ -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 reference: ${vars.foo}")
}