Skip to content

Commit

Permalink
Consider HTTP status for more meaningful errors
Browse files Browse the repository at this point in the history
The krew CI has quite a few problems on travis, supposedly due to
API quota violation. For more meaningful errors, we now consider the
HTTP status code of the GitHub API response.
  • Loading branch information
corneliusweig committed Feb 27, 2020
1 parent c3b34c1 commit c4830b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/krew/cmd/internal/fetch_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func FetchLatestTag() (string, error) {
if err != nil {
return "", errors.Wrapf(err, "could not GET the latest release")
}
if response.StatusCode != http.StatusOK {
return "", errors.Errorf("expected HTTP status 200 OK, got %s", response.Status)
}
defer response.Body.Close()

var res struct {
Expand Down

0 comments on commit c4830b3

Please sign in to comment.