mirror of
https://github.com/golang/go
synced 2024-11-11 20:20:23 -07:00
misc/dashboard/codereview: better debugging when some fetches fail.
R=rsc CC=golang-dev https://golang.org/cl/7836045
This commit is contained in:
parent
e3c7a9db83
commit
247bc72131
@ -178,8 +178,14 @@ func handleAssign(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
c.Errorf("Failed reading body: %v", err)
|
||||||
|
http.Error(w, err.Error(), 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
c.Errorf("Retrieving CL reviewer list failed: got HTTP response %d", resp.StatusCode)
|
c.Errorf("Retrieving CL reviewer list failed: got HTTP response %d\nBody: %s", resp.StatusCode, body)
|
||||||
http.Error(w, "Failed contacting Rietveld", 500)
|
http.Error(w, "Failed contacting Rietveld", 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -187,7 +193,7 @@ func handleAssign(w http.ResponseWriter, r *http.Request) {
|
|||||||
var apiResp struct {
|
var apiResp struct {
|
||||||
Reviewers []string `json:"reviewers"`
|
Reviewers []string `json:"reviewers"`
|
||||||
}
|
}
|
||||||
if err := json.NewDecoder(resp.Body).Decode(&apiResp); err != nil {
|
if err := json.Unmarshal(body, &apiResp); err != nil {
|
||||||
// probably can't be retried
|
// probably can't be retried
|
||||||
msg := fmt.Sprintf("Malformed JSON from %v: %v", url, err)
|
msg := fmt.Sprintf("Malformed JSON from %v: %v", url, err)
|
||||||
c.Errorf("%s", msg)
|
c.Errorf("%s", msg)
|
||||||
@ -212,8 +218,14 @@ func handleAssign(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
c.Errorf("Failed reading Gobot body: %v", err)
|
||||||
|
http.Error(w, err.Error(), 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
c.Errorf("Gobot GET failed: got HTTP response %d", resp.StatusCode)
|
c.Errorf("Gobot GET failed: got HTTP response %d\nBody: %s", resp.StatusCode, body)
|
||||||
http.Error(w, "Failed contacting Gobot", 500)
|
http.Error(w, "Failed contacting Gobot", 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user