fix: friendlier error for unauthenticated user#62
Closed
gianarb wants to merge 1 commit into
Closed
Conversation
Contributor
|
Could we make this error message more friendly and remove some of the technical details like Here's what I'm thinking:
Maybe if the user kicks on verbose mode using |
gianarb
force-pushed
the
fix/clarify-err-message-for-unauthorized-user
branch
from
January 19, 2026 13:11
37c7d31 to
a7cae01
Compare
Collaborator
Author
I changed the error message for now. I would like to keep error handling/logging to its own PR because my plan is to go over all the commands that are not imported straight from kubectl to use the kube logger. |
When a user is not logged, and never logged in the error message is not that actionable. It says the user thy should login but now how to do it. As reported by @ecv we can do a lot better. There is another error that looks similar but exposes the right command to run to login. This commit uses the same approach. This is the current one in main ``` panic: failed to get token source: no active user set. Please login first goroutine 1 [running]: go.datum.net/datumctl/internal/cmd.RootCmd() /home/gianarb/git/datum/datumctl/internal/cmd/root.go:38 +0xc3a main.main() /home/gianarb/git/datum/datumctl/main.go:15 +0x32 exit status 2 ``` Here what user will get with this commit: ``` panic: failed to get token source: no active user set. Please login first using 'datumctl auth login' goroutine 1 [running]: go.datum.net/datumctl/internal/cmd.RootCmd() /home/gianarb/git/datum/datumctl/internal/cmd/root.go:38 +0xc3a main.main() /home/gianarb/git/datum/datumctl/main.go:15 +0x32 exit status 2 ``` NOTE: There is another race condition related to when we run authentication and it prevents the `help` command to get printed to the user. But I am working at it in another PR
gianarb
force-pushed
the
fix/clarify-err-message-for-unauthorized-user
branch
from
January 19, 2026 13:13
a7cae01 to
bb05c83
Compare
gianarb
enabled auto-merge
January 19, 2026 16:39
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a user is not logged, and never logged in the error message is not
that actionable. It says the user thy should login but now how to do it.
As reported by @ecv we can do a lot better.
There is another error that looks similar but exposes the right command
to run to login. This commit uses the same approach.
This is the current one in main
Here what user will get with this commit:
NOTE: There is another race condition related to when we run
authentication and it prevents the
helpcommand to get printed to theuser. But I am working at it in another PR
Related #54