Skip to content

Commit 0074c3a

Browse files
committed
preserve error type in loginoptions
1 parent 6b1a836 commit 0074c3a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/oc/cli/cmd/login/loginoptions.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type LoginOptions struct {
5656
Config *restclient.Config
5757
Reader io.Reader
5858
Out io.Writer
59+
ErrOut io.Writer
5960

6061
// cert data to be used when authenticating
6162
CertFile string
@@ -231,10 +232,15 @@ func (o *LoginOptions) gatherAuthInfo() error {
231232
// client is connecting to the right host:port
232233
if statusErr, ok := err.(*kerrors.StatusError); ok {
233234
if statusErr.Status().Code == http.StatusInternalServerError {
234-
return fmt.Errorf("error: The server was unable to respond - %v", suggestion)
235+
fmt.Fprintf(o.ErrOut, "error: The server was unable to respond - %v", suggestion)
235236
}
237+
} else {
238+
fmt.Fprintf(o.ErrOut, "error: %v - %v\n", err, suggestion)
236239
}
237-
return fmt.Errorf("%v - %v", err, suggestion)
240+
241+
// TODO: set errout
242+
// return error as-is, as method caller expects to check its type
243+
return err
238244
}
239245
clientConfig.BearerToken = token
240246

0 commit comments

Comments
 (0)