Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle github api overload #128

Merged
merged 4 commits into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func isLatestVersion() bool {
body, _ := io.ReadAll(resp.Body)
resp.Body.Close()

if resp.StatusCode == 403 {
pterm.Warning.Printf("Unable to check latest version (version check API unavailable). Continuing.\n")
return true
}

var data versionInfo
var retry bool
err = json.Unmarshal(body, &data)
Expand All @@ -131,7 +136,7 @@ func isLatestVersion() bool {
}

if version != data.TagName {
pterm.Warning.Printf("You are running older version of ridectl %s\n", version)
pterm.Warning.Printf("You are running an older version of ridectl: %s. Latest: %s\n.", version, data.TagName)
return false
}

Expand Down