From 21708847860f2b318619eb8c0f066acfc5fc38eb Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Wed, 14 Sep 2016 13:43:51 -0700 Subject: [PATCH] skip bad github responses --- commands/refresh_github_commits.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commands/refresh_github_commits.go b/commands/refresh_github_commits.go index 89a26a15f0..5aeac7b6b3 100644 --- a/commands/refresh_github_commits.go +++ b/commands/refresh_github_commits.go @@ -7,6 +7,7 @@ package commands import ( "cocoon/db" "encoding/json" + "fmt" "io/ioutil" "golang.org/x/net/context" @@ -40,6 +41,10 @@ func RefreshGithubCommits(cocoon *db.Cocoon, inputJSON []byte) (interface{}, err return nil, err } + if githubResp.StatusCode != 200 { + return nil, fmt.Errorf("GitHub API responded with a non-200 HTTP status: %v", githubResp.StatusCode) + } + defer githubResp.Body.Close() commitData, err := ioutil.ReadAll(githubResp.Body)