Skip to content

Commit 4eac2f8

Browse files
committed
🐛 manage errors from github api properly
1 parent b0f55eb commit 4eac2f8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

internal/stars.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,12 @@ func doWithRetry(httpclient *http.Client, req *http.Request) (*http.Response, er
241241

242242
for {
243243
resp, err := httpclient.Do(req)
244-
if err == nil {
245-
if resp.StatusCode >= http.StatusInternalServerError {
246-
log.Fatalf("Github server error: %d", resp.StatusCode)
247-
}
248-
244+
if err == nil && resp.StatusCode == http.StatusOK {
249245
return resp, nil
250246
}
247+
if err == nil {
248+
log.Warn("Github server error", "status", resp.StatusCode)
249+
}
251250

252251
i++
253252
if i >= MAX_RETRY {

0 commit comments

Comments
 (0)