feat: Improve messaging for common cloud config and rpc errors #2885
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.
This turned out to have more changes than I expected. A high-level list follows. There are definitely some style choices I made here that I'm not at all attached to, so feel free to recommend changes.
Add a UnaryClientInterceptor for all gRPC client connections to catch and rewrite unauthenticated error messages
Put the sqlc auth token in the config struct, and add simple validation
Add more explanatory error messages in cases where users try to use cloud features without the proper configuration
Prevent sending the SQLC_AUTH_TOKEN env var to plugins
Resolves #2881