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.
| case errors.Is(err, dbc.ErrUnauthorized): | ||
| return errStyle.Render(err.Error()) | ||
| return errStyle.Render(err.Error()) + "\n" + | ||
| msgStyle.Render("Did you run `dbc auth login`?") | ||
| 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.
formatErr() output for dbc.ErrUnauthorized / dbc.ErrUnauthorizedColumnar is user-facing and has changed, but there don’t appear to be any tests asserting these hints. Consider adding a small unit test that passes wrapped errors (e.g., fmt.Errorf("...: %w", dbc.ErrUnauthorized)) and verifies the returned string contains the expected hint lines (and still includes the original error text).
| 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.
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