-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return *all* custom mapping errors, not just the first one (#2743)
The only semantic change in this PR is here: ```patch @@ -1408,20 +1409,20 @@ func (g *Generator) gatherResource(rawname string, } // Ensure there weren't any custom fields that were unrecognized. + var errs []error for key := range info.Fields { if _, has := schema.Schema().GetOk(key); !has { msg := fmt.Sprintf("there is a custom mapping on resource '%s' for field '%s', but the field was not "+ "found in the Terraform metadata and will be ignored. To fix, remove the mapping.", rawname, key) - if cmdutil.IsTruthy(os.Getenv("PULUMI_EXTRA_MAPPING_ERROR")) { - return nil, errors.New(msg) + errs = append(errs, errors.New(msg)) + } else { + g.warn(msg) } - - g.warn(msg) } } - return res, nil + return res, errors.Join(errs...) } func (g *Generator) gatherDataSources() (moduleMap, error) { ``` The rest is just renaming "github.com/pkg/errors" from `errors` to `pkgerrors` so we can add an un-aliased `"errors"`.
- Loading branch information
Showing
1 changed file
with
24 additions
and
23 deletions.
There are no files selected for viewing
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