From 1ed8070387a9d92d18c21d95ce3d33ce8ede8dff 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 is >= 400 --- internal/download/fetch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/download/fetch.go b/internal/download/fetch.go index 41d9b72a..4874da22 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 >= 400 { + return nil, errors.Errorf("failed to download %q, status code %d", uri, resp.StatusCode) + } return resp.Body, nil }