From d7240558933af313b20c5be2762aa08acfd7614f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Mon, 20 Feb 2023 08:09:14 +0000 Subject: [PATCH] detect download failures when StatusCode > 200 --- internal/download/fetch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/download/fetch.go b/internal/download/fetch.go index 41d9b72a..674904e9 100644 --- a/internal/download/fetch.go +++ b/internal/download/fetch.go @@ -41,6 +41,9 @@ func (HTTPFetcher) Get(uri string) (io.ReadCloser, error) { if err != nil { return nil, errors.Wrapf(err, "failed to download %q", uri) } + if resp.StatusCode >= 200 { + return nil, errors.Errorf("failed to download %q, status code %d", uri, resp.StatusCode) + } return resp.Body, nil }