Skip to content
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

Do not wrap 'logged out' error #225

Merged
merged 3 commits into from
Apr 2, 2021
Merged

Do not wrap 'logged out' error #225

merged 3 commits into from
Apr 2, 2021

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Apr 2, 2021

Description

When running the auth logout command when there are no logged in tenants, the error message displayed Unable to load tenants due to an unexpected error: Not yet configured. Try 'auth0 login'. is not really appropriate as there are no tenants to load.
This PR changes the error message to simply Not logged in. Try 'auth0 login'..

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@Widcket Widcket requested a review from a team April 2, 2021 17:27
@@ -21,7 +21,7 @@ func logoutCmd(cli *cli) *cobra.Command {
if len(args) == 0 {
tens, err := cli.listTenants()
if err != nil {
return fmt.Errorf("Unable to load tenants due to an unexpected error: %w", err)
return err // This error is already formatted for display
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible for another err other than errUnauthenticated to be returned? Do we need to check that it is that error?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good Q @aherzog-auth0 . It boils down to two other error types:

  • json.Unmarshal
  • os.ReadFile

If we want this to be complete, we can check errUnauthenticated, return it as is, otherwise do an error wrap with Unexpected error: %w type pattern.

What do you think @Widcket ?

@Widcket Widcket merged commit 93b8b04 into main Apr 2, 2021
@Widcket Widcket deleted the logged-out-error-message branch April 2, 2021 18:59
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.

3 participants