Conversation
Restores helpful hints that were lost in the error handling refactor (#279): - Added hint for ErrUnauthorized: "Did you run \`dbc auth login\`?" - Restored simpler hint for ErrUnauthorizedColumnar with original wording These hints were originally added in #255 to help users troubleshoot authorization issues when installing private drivers. Fixes #315
There was a problem hiding this comment.
Pull request overview
Restores concise, user-helpful hints in CLI error formatting for unauthorized cases, addressing regressions introduced during the earlier error-handling refactor (#279).
Changes:
- Add a troubleshooting hint for
dbc.ErrUnauthorized: “Did you rundbc auth login?” - Restore the shorter, original hint text for
dbc.ErrUnauthorizedColumnar(license/support guidance).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return errStyle.Render(err.Error()) + "\n" + | ||
| msgStyle.Render("Did you run `dbc auth login`?") | ||
| case errors.Is(err, dbc.ErrUnauthorizedColumnar): |
There was a problem hiding this comment.
msgStyle is defined in cmd/dbc/add.go but is now also used by cmd/dbc/main.go. To avoid hidden cross-file coupling (and make styles easier to discover), consider moving msgStyle (and possibly errStyle) into a dedicated shared file (e.g., cmd/dbc/styles.go) in the main package.
|
@zeroshade I've opened a new pull request, #322, to work on those changes. Once the pull request is ready, I'll request review from you. |
`formatErr()` output changed for `dbc.ErrUnauthorized` and `dbc.ErrUnauthorizedColumnar` in #321, but no tests covered the hint lines appended to those errors. ## Changes - **`cmd/dbc/main_test.go`**: Added `TestFormatErr` covering all four cases — direct and `fmt.Errorf`-wrapped variants of both sentinel errors — asserting the output contains both the original error text and the expected hint: ```go fmt.Errorf("operation failed: %w", dbc.ErrUnauthorized) // → contains "not authorized" + "Did you run `dbc auth login`?" fmt.Errorf("operation failed: %w", dbc.ErrUnauthorizedColumnar) // → contains "not authorized to access" + "active license" + "support@columnar.tech" ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: zeroshade <555095+zeroshade@users.noreply.github.com>
cmd/dbc/main.go
Outdated
| case errors.Is(err, dbc.ErrUnauthorizedColumnar): | ||
| return errStyle.Render(err.Error()) + "\n" + | ||
| msgStyle.Render("Installing this driver requires a license. Verify you have an active license at https://console.columnar.tech/licenses and try this command again. Contact support@columnar.tech if you believe this is an error.") | ||
| msgStyle.Render("Do you have an active license for this driver? Contact support@columnar.tech for assistance.") |
There was a problem hiding this comment.
Was reverting this improvement to the error message intended here?
There was a problem hiding this comment.
that's a good point and my mistake there. The current version of this is better, i'll fix that
Summary
Restores helpful hints that were lost in the error handling refactor (#279):
ErrUnauthorized: "Did you rundbc auth login?"ErrUnauthorizedColumnarwith original wording from feat(install): give hint when unauthorized #255Context
These hints were originally added in #255 to help users troubleshoot authorization issues when installing private drivers. During the error handling refactor in #279, these hints were either removed or changed to more verbose messages.
Changes
cmd/dbc/main.go: UpdatedformatErr()function to include both helpful hintsFixes #315