Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for Invalid or unknown key #1663

Merged
merged 8 commits into from
Feb 2, 2024
Merged

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Jan 31, 2024

Per pulumi/pulumi#3546 it is possible that when a user specifies aws:foo config in a Pulumi program she is not intending it to be picked up by the aws provider. This change improves the error message emitted in this case to guide the user better.

@@ -1118,8 +1149,8 @@ func TestCheckConfig(t *testing.T) {
})
require.NoError(t, err)
require.Equal(t, 1, len(resp.Failures))
require.Equal(t, "could not validate provider configuration: "+
"Invalid or unknown key. Examine values at 'explicitprovider.requiredprop'.",
require.Equal(t, "could not validate provider configuration: Invalid or unknown key. "+
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental edit, disregard, this stays the same. The explicit provider error should be very rare as it should be a compilation error typically in TypeScript.

@t0yv0
Copy link
Member Author

t0yv0 commented Jan 31, 2024

CC @zbuchheit

"Did you mean `testprovider:configValue`?",
require.Equal(t, "`testprovider:cofnigValue` is not a valid configuration key for the testprovider provider. "+
"Did you mean `testprovider:configValue`? "+
"If the key is not intended for the provider, please choose a different namespace from `testprovider:`.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"If the key is not intended for the provider, please choose a different namespace from `testprovider:`.",
"If the referenced key is not intended for the provider, please choose a different namespace from `testprovider:`.",

nit: makes it more specific

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a clear improvement.

@t0yv0 t0yv0 merged commit 75d8398 into master Feb 2, 2024
7 checks passed
@t0yv0 t0yv0 deleted the t0yv0/fix-errmsg branch February 2, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants