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

Use result.Result in more places. #2568

Merged
merged 43 commits into from Mar 19, 2019
Merged

Use result.Result in more places. #2568

merged 43 commits into from Mar 19, 2019

Conversation

CyrusNajmabadi
Copy link
Contributor

No description provided.

return nil, res
}

return nil, result.Error("an error occurred while advancing the preview")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunate. it seems like we've lost the original err information (this was a problem before).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's OK - we should have already printed it, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, nevermind - in this case, we won't have printed it. Could you instead return res verbatim without creating the new error?

"run_error": {
program: path.join(base, "040.run_error"),
expectResourceCount: 0,
expectError: "Program exited with non-zero exit code: 1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this error will change in a followup PR.

@CyrusNajmabadi CyrusNajmabadi added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Mar 19, 2019
if res != nil {
err = res.Error()
}

// Figure out if execution failed and why. Step generation and execution errors trump cancellation.
if err != nil || pe.stepExec.Errored() {
err = execError("failed", preview)
} else if canceled {
err = execError("canceled", preview)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking this should be a bail as well; cancellation doesn't sound to me like something that should be a non-bail Result.

Copy link
Contributor

@swgillespie swgillespie left a comment

Choose a reason for hiding this comment

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

LGTM, looks similar to the PR we reviewed together last week.

Co-Authored-By: CyrusNajmabadi <cyrus.najmabadi@gmail.com>
@CyrusNajmabadi CyrusNajmabadi merged commit c6d8715 into master Mar 19, 2019
@pulumi-bot pulumi-bot deleted the useResult2 branch March 19, 2019 23:21
@CyrusNajmabadi
Copy link
Contributor Author

Talked to @swgillespie . Will take on some of hte feedback later when we can be sure we don't make any scenarios worse. specificaly, we don't wnat to end up printing out the same error multiple times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants