Return Kubernetes full error message (#1560)

This PR let the controller returns the detail error message
of kubernetes error which makes users understand what's
happening instead of meanless error msg.
This commit is contained in:
Ta-Ching Chen
2020-03-24 00:15:25 +08:00
committed by GitHub
parent a04c40d016
commit e867b220a1
+1 -1
View File
@@ -113,7 +113,7 @@ func (api *API) respondWithError(w http.ResponseWriter, err error) {
se, ok := err.(*kerrors.StatusError)
if ok {
api.logger.Error(err.Error(), zap.Int32("code", se.ErrStatus.Code))
http.Error(w, string(se.ErrStatus.Reason), int(se.ErrStatus.Code))
http.Error(w, se.Error(), int(se.ErrStatus.Code))
return
}