Skip to content

fix: restore hints when unauthorized#321

Merged
zeroshade merged 3 commits intomainfrom
fix-315-restore-unauthorized-hints
Feb 24, 2026
Merged

fix: restore hints when unauthorized#321
zeroshade merged 3 commits 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 +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.
Copy link
Contributor

Copilot AI commented Feb 23, 2026

@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.")
Copy link
Member

Choose a reason for hiding this comment

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

Was reverting this improvement to the error message intended here?

Copy link
Member Author

Choose a reason for hiding this comment

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

that's a good point and my mistake there. The current version of this is better, i'll fix that

Copy link
Member

@amoeba amoeba left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks.

@zeroshade zeroshade merged commit dc7ac6b into main Feb 24, 2026
11 checks passed
@zeroshade zeroshade deleted the fix-315-restore-unauthorized-hints branch February 24, 2026 16:28
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

4 participants