Skip to content

Commit

Permalink
detect download failures when StatusCode is >= 400
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-garcia committed Feb 20, 2023
1 parent e9e3f41 commit 1ed8070
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/download/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 1ed8070

Please sign in to comment.