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:
@@ -113,7 +113,7 @@ func (api *API) respondWithError(w http.ResponseWriter, err error) {
|
|||||||
se, ok := err.(*kerrors.StatusError)
|
se, ok := err.(*kerrors.StatusError)
|
||||||
if ok {
|
if ok {
|
||||||
api.logger.Error(err.Error(), zap.Int32("code", se.ErrStatus.Code))
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user