Skip to content

Commit

Permalink
detect download failures when StatusCode > 200
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-garcia committed Feb 26, 2023
1 parent e9e3f41 commit d724055
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 >= 200 {
return nil, errors.Errorf("failed to download %q, status code %d", uri, resp.StatusCode)
}
return resp.Body, nil
}

Expand Down

0 comments on commit d724055

Please sign in to comment.