Skip to content

Commit

Permalink
commands/auth: fix 0-return on unsuccessful login attempts (mattermos…
Browse files Browse the repository at this point in the history
…t#499)

* commands/auth: fix 0-return on unsuccessful login attempts

* reflect review comments
  • Loading branch information
isacikgoz authored Apr 6, 2022
1 parent 4d7dab5 commit 3abf3e8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions commands/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ func loginCmdF(cmd *cobra.Command, args []string) error {
c, _, err = InitClientWithUsernameAndPassword(username, password, url, allowInsecureSHA1, allowInsecureTLS)
}
if err != nil {
printer.PrintError(err.Error())
// We don't want usage to be printed as the command was correctly built
return nil
return fmt.Errorf("could not initiate client: %w", err)
}
accessToken = c.AuthToken
} else {
Expand All @@ -222,9 +220,7 @@ func loginCmdF(cmd *cobra.Command, args []string) error {
AuthToken: accessToken,
}
if _, _, err := InitClientWithCredentials(&credentials, allowInsecureSHA1, allowInsecureTLS); err != nil {
printer.PrintError(err.Error())
// We don't want usage to be printed as the command was correctly built
return nil
return fmt.Errorf("could not initiate client: %w", err)
}
}

Expand Down

0 comments on commit 3abf3e8

Please sign in to comment.