diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-05-20 14:35:10 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-05-20 14:35:10 +0200 |
commit | 8a4d38bd2252d7c4040a7116e8a14e63db5af78d (patch) | |
tree | 066c0b8ff7920e001a25b12bc15d237fbcffdff9 | |
parent | 8714537ecffa0641516bc01b8cdc4cdd9a9d975c (diff) | |
download | refcat-8a4d38bd2252d7c4040a7116e8a14e63db5af78d.tar.gz refcat-8a4d38bd2252d7c4040a7116e8a14e63db5af78d.zip |
cdx: fail on >=400 status
-rw-r--r-- | skate/cdx.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/skate/cdx.go b/skate/cdx.go index ed394ed..6378bf6 100644 --- a/skate/cdx.go +++ b/skate/cdx.go @@ -105,6 +105,9 @@ func LookupCDX(link string) (result CDX, b []byte, err error) { return nil, b, err } defer resp.Body.Close() + if resp.StatusCode >= 400 { + return nil, nil, fmt.Errorf("api returned HTTP %v", resp.StatusCode) + } b, err = ioutil.ReadAll(resp.Body) if err != nil { return nil, b, err |