diff --git a/influx/influx.go b/influx/influx.go index 3edab0b20..90dba9008 100644 --- a/influx/influx.go +++ b/influx/influx.go @@ -59,6 +59,9 @@ func query(u *url.URL, q mrfusion.Query) (mrfusion.Response, error) { return nil, err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("received status code %d from server", resp.StatusCode) + } var response Response dec := json.NewDecoder(resp.Body) @@ -73,6 +76,7 @@ func query(u *url.URL, q mrfusion.Query) (mrfusion.Response, error) { if decErr != nil { return nil, fmt.Errorf("unable to decode json: received status code %d err: %s", resp.StatusCode, decErr) } + // If we don't have an error in our json response, and didn't get statusOK // then send back an error if resp.StatusCode != http.StatusOK && response.Err != "" {