pass along status errors for upgrades

pull/6/head
deads2k 2015-07-15 15:53:29 -04:00
parent 52848062f3
commit 98d6b454f3
1 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,8 @@ import (
"net/http"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil"
)
@ -137,6 +139,11 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec
if err != nil {
responseError = "Unable to read error from server response"
} else {
if obj, err := api.Scheme.Decode(responseErrorBytes); err == nil {
if status, ok := obj.(*api.Status); ok {
return nil, &apierrors.StatusError{*status}
}
}
responseError = string(responseErrorBytes)
}