Skip to content

Comments

fix: restore hints when unauthorized#321

Open
zeroshade wants to merge 1 commit intomainfrom
fix-315-restore-unauthorized-hints
Open

fix: restore hints when unauthorized#321
zeroshade wants to merge 1 commit intomainfrom
fix-315-restore-unauthorized-hints

Conversation

@zeroshade
Copy link
Member

@zeroshade zeroshade commented Feb 20, 2026

Summary

Restores helpful hints that were lost in the error handling refactor (#279):

Context

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: Updated formatErr() function to include both helpful hints

Fixes #315

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
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 run dbc 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.

Comment on lines 155 to +160
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.")
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +156 to 158
return errStyle.Render(err.Error()) + "\n" +
msgStyle.Render("Did you run `dbc auth login`?")
case errors.Is(err, dbc.ErrUnauthorizedColumnar):
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore hints when unauthorized

1 participant