Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
11019: Improve error message for invalid enum values on `pulumi convert` r=aq17 a=aq17 Fixes #10814 Currently if an invalid enum value is provided, `(nil, true)` is returned [here](https://github.com/pulumi/pulumi/blob/master/pkg/codegen/pcl/binder_schema.go#L498). On `pulumi convert`, we still try to translate the PCL to the resulting language [here](https://github.com/pulumi/pulumi/blob/master/pkg/codegen/pcl/binder_schema.go#L569), causing an unhelpful error message `(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference)` to be injected into the invalid program text (example in #10814). This change improves it a bit so that the valid enum values are provided in the error message, i.e. `(PANIC=Format method: fatal: A failure has occurred: Invalid enum provided: valid values are [Block Append])` Co-authored-by: aq17 <aqiu@pulumi.com>
- Loading branch information
Showing
7 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...0221201--programgen--improve-error-message-for-invalid-enum-values-on-pulumi-convert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: fix | ||
scope: programgen | ||
description: Improve error message for invalid enum values on `pulumi convert`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters