mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Improve error reporting
This commit is contained in:
parent
4e1ab8045b
commit
72c922668f
@ -278,7 +278,11 @@ func (r *Request) Watch() (watch.Interface, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return nil, fmt.Errorf("Got status: %v", resp.StatusCode)
|
var body []byte
|
||||||
|
if resp.Body != nil {
|
||||||
|
body, _ = ioutil.ReadAll(resp.Body)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("For request '%v', got status: %v\nbody: %v", req.URL, resp.StatusCode, string(body))
|
||||||
}
|
}
|
||||||
return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil
|
return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil
|
||||||
}
|
}
|
||||||
|
@ -106,11 +106,9 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove this function and references to it-- errors it prints are
|
|
||||||
// very unhelpful because file/line number are wrong.
|
|
||||||
func checkErr(err error) {
|
func checkErr(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("%v", err)
|
glog.FatalDepth(1, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user