Fix invoke error reporting. (#3048)

- Report all failures
- Use appropriate member functions to access failure details

Fixes https://github.com/pulumi/pulumi-terraform/issues/396
This commit is contained in:
Pat Gavlin 2019-08-08 09:14:36 -07:00 committed by GitHub
parent 154c1caa43
commit 3c03ee3bdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -11,6 +11,9 @@ CHANGELOG
- Fix a bug in the GitHub Actions program preventing errors from being rendered in the Actions log on github.com.
[#3036](https://github.com/pulumi/pulumi/pull/3036)
- Fix a bug in the Node.JS SDK that caused failure details for provider functions to go unreported.
[#3048](https://github.com/pulumi/pulumi/pull/3048)
## 0.17.28 (2019-08-05)
- Retry renaming a temporary folder during plugin installation

View file

@ -83,7 +83,14 @@ export async function invoke(tok: string, props: Inputs, opts?: InvokeOptions):
// If there were failures, propagate them.
const failures: any = resp.getFailuresList();
if (failures && failures.length) {
throw new Error(`Invoke of '${tok}' failed: ${failures[0].reason} (${failures[0].property})`);
let reasons = "";
for (let i = 0; i < failures.length; i++) {
if (reasons !== "") {
reasons += "; ";
}
reasons += `${failures[i].getReason()} (${failures[i].getProperty()})`;
}
throw new Error(`Invoke of '${tok}' failed: ${reasons}`);
}
// Finally propagate any other properties that were given to us as outputs.