Catch and log non-200 http responses from Chromeperf anomaly endpoint.

Previously, something like an Authentication error from Skia Bridge wouldn't fail right away and it was difficult to debug.

Change-Id: Ic8a78d3c2d01560a4464eebf6f058ed8571c50d1
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/766698
Reviewed-by: Ashwin Verleker <ashwinpv@google.com>
Commit-Queue: Eduardo Yap <eduardoyap@google.com>
diff --git a/perf/go/anomalies/chrome/chrome.go b/perf/go/anomalies/chrome/chrome.go
index 88e1a3d..83c8d3d 100644
--- a/perf/go/anomalies/chrome/chrome.go
+++ b/perf/go/anomalies/chrome/chrome.go
@@ -3,6 +3,7 @@
 import (
 	"context"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"io"
 	"net/http"
@@ -121,6 +122,11 @@
 	if err != nil {
 		return nil, skerr.Wrapf(err, "Failed to read body from chrome perf response.")
 	}
+	if httpResponse.StatusCode != http.StatusOK {
+		errMsg := fmt.Sprintf("The request failed with status code %d and body: %s", httpResponse.StatusCode, string(respBody))
+		err = errors.New(errMsg)
+		return nil, skerr.Wrapf(err, "Chromeperf Anomalies request failed.")
+	}
 
 	resp := chromePerfResponse{}
 	err = json.Unmarshal([]byte(respBody), &resp)