From 196bd864cdb5558e6cc0b86391531f7381286651 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Wed, 8 Jun 2016 15:18:28 -0700 Subject: [PATCH] Properly handle non-200 responses from logs --- ct/client/logclient.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ct/client/logclient.go b/ct/client/logclient.go index 2b18acf..d63fe15 100644 --- a/ct/client/logclient.go +++ b/ct/client/logclient.go @@ -106,6 +106,9 @@ func (c *LogClient) fetchAndParse(uri string, res interface{}) error { if err != nil { return err } + if resp.StatusCode / 100 != 2 { + return fmt.Errorf("GET %s: %s (%s)", uri, resp.Status, string(body)) + } if err = json.Unmarshal(body, &res); err != nil { return err }