mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Handle Stream() errors consistently in restclient
We should be following the same rules for Stream() as the normal body request flow. Also add slightly more output on a server error - in the future we may want to clean this up but it's potentially hiding bad responses.
This commit is contained in:
@@ -196,8 +196,10 @@ func StandardErrorMessage(err error) (string, bool) {
|
||||
switch {
|
||||
case isStatus:
|
||||
switch s := status.Status(); {
|
||||
case s.Reason == "Unauthorized":
|
||||
case s.Reason == unversioned.StatusReasonUnauthorized:
|
||||
return fmt.Sprintf("error: You must be logged in to the server (%s)", s.Message), true
|
||||
case len(s.Reason) > 0:
|
||||
return fmt.Sprintf("Error from server (%s): %s", s.Reason, err.Error()), true
|
||||
default:
|
||||
return fmt.Sprintf("Error from server: %s", err.Error()), true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user