-
Notifications
You must be signed in to change notification settings - Fork 1
[TOW-1275] Emit proper error message for not logged in when running cmd #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves error handling by replacing generic error messages with proper error reporting through output::tower_error(), ensuring users receive appropriate feedback (e.g., when not logged in) when commands fail.
Key Changes:
- Replaced generic "There was a problem with the Tower API" messages with
output::tower_error()calls - Converted
if letpatterns tomatchexpressions for consistent error handling - Added explicit
std::process::exit(1)calls after error handling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/tower-cmd/src/secrets.rs | Updated error handling in do_create, do_delete, and encrypt_and_create_secret to use tower_error() and explicit process exits |
| crates/tower-cmd/src/run.rs | Replaced debug logging with tower_error() calls in get_secrets and get_catalogs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bradhe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small things, it's on the right track.
- We should move the logic for error handling up a level in the
get_secretsAPI wrapper. We don't want the API logic managing the output state. - Let's create a
tower_error_and_diefunction and use it instead of callingexitdirectly to normalize exit codes.secrets::do_createshould be updated to address this I think.
|
@bradhe I've made an update to refactor spinner and error handling to be more consistent everywhere while taking your feedback into account. With this change all commands look like follows with login error |
bradhe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally good moving forward with what we have here; however, there's one improvement I suggested. It'd be ideal if you could implement that, then land this thing!
Emit proper error message for not logged in when running cmd
eg: