From c4830b3c99228ab6c8fcb6e018c80a810e68c31c Mon Sep 17 00:00:00 2001 From: Cornelius Weig Date: Thu, 27 Feb 2020 21:37:07 +0100 Subject: [PATCH] Consider HTTP status for more meaningful errors 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. --- cmd/krew/cmd/internal/fetch_tag.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/krew/cmd/internal/fetch_tag.go b/cmd/krew/cmd/internal/fetch_tag.go index 8ec5ce77..51697920 100644 --- a/cmd/krew/cmd/internal/fetch_tag.go +++ b/cmd/krew/cmd/internal/fetch_tag.go @@ -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 {