Skip to content

Commit

Permalink
preserve error type in loginoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Nov 2, 2017
1 parent 6b1a836 commit 0074c3a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/oc/cli/cmd/login/loginoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type LoginOptions struct {
Config *restclient.Config
Reader io.Reader
Out io.Writer
ErrOut io.Writer

// cert data to be used when authenticating
CertFile string
Expand Down Expand Up @@ -231,10 +232,15 @@ func (o *LoginOptions) gatherAuthInfo() error {
// client is connecting to the right host:port
if statusErr, ok := err.(*kerrors.StatusError); ok {
if statusErr.Status().Code == http.StatusInternalServerError {
return fmt.Errorf("error: The server was unable to respond - %v", suggestion)
fmt.Fprintf(o.ErrOut, "error: The server was unable to respond - %v", suggestion)
}
} else {
fmt.Fprintf(o.ErrOut, "error: %v - %v\n", err, suggestion)
}
return fmt.Errorf("%v - %v", err, suggestion)

// TODO: set errout
// return error as-is, as method caller expects to check its type
return err
}
clientConfig.BearerToken = token

Expand Down

0 comments on commit 0074c3a

Please sign in to comment.