Change exceptions thrown in setup tasks into task failures, and add more details to error logging #1071
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the pull request
Currently, if there is an error in the elevated install task, we would just propagate the exception, instead of logging it and marking the task and failed. And on the main process side, we assumed that any error would show up as a task failure and we would not deal with exceptions. Then, on the loading page, when an exception occurred we would not set the task result state.
This all resulted in exceptions on the elevated install task side causing the task to disappear from the summary page, as it had no valid state.
This PR adds some better guardrails in these places to handle exceptions. It also updates the logging of errors to better use the logger we have that prints the full exception details by default, instead of manually getting the exception message without much detail.
References and relevant issues
https://task.ms/44717643
Detailed description of the pull request / Additional comments
Validation steps performed
PR checklist