-
Couldn't load subscription status.
- Fork 10.1k
Refactor backend error strings as custom errors or pre-made diagnostics #37762
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
Conversation
…for creating diagnostics directly
…loudDiag` for creating diagnostics directly
…eSavedDiag` for creating diagnostics directly
…e failing to write to backend state files happens
|
Something to bear in mind is whether these changes could impact any parsing of human-readable output by HCP Terraform. I believe these changes don't impact output for a few reasons:
However if there are any further tests that would be useful to ensure that's true, I'd need to guidance about where to start, if needed. |
| diags = diags.Append(err) | ||
| diags = diags.Append(errBackendWriteSavedDiag(err)) | ||
| } | ||
| // No need to call PersistState as it's a no-op |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlighting this - this is a place where I have actually changed something about the output from Terraform. This error wasn't 'wrapped' in the same way that other errors (from WriteState or PersistState) were handled elsewhere in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring 👍🏻
Following this feedback: #37732 (comment)
This PR replaces
conststrings, used to construct errors when using backends (incl.cloudblock), with custom errors and custom pre-made diagnostics.Custom errors are used where:
errBackendNoExistingWorkspaces)Pre-made diagnostics are used where:
Target Release
N/A
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry