Skip to content

Commit

Permalink
Add status check to ensure we gracefully discontinue (#158)
Browse files Browse the repository at this point in the history
* Add status check to ensure we gracefully discontinue

* Update log message to reflect status code and message if any

* Split err and status checks to avoid a null dereference error

* Adress new line warning on gostatic check
  • Loading branch information
vimystic authored Jul 27, 2023
1 parent 943bdae commit 2da0b66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func mostRecentReleasesForChain(
number int16,
) (builder.HeighlinerQueuedChainBuilds, error) {
if chainNodeConfig.GithubOrganization == "" || chainNodeConfig.GithubRepo == "" {
return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("github organization: %s and/or repo: %s not provided for chain: %s\n", chainNodeConfig.GithubOrganization, chainNodeConfig.GithubRepo, chainNodeConfig.Name)
return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("github organization: %s and/or repo: %s not provided for chain: %s", chainNodeConfig.GithubOrganization, chainNodeConfig.GithubRepo, chainNodeConfig.Name)
}
client := http.Client{Timeout: 5 * time.Second}

Expand All @@ -47,6 +47,9 @@ func mostRecentReleasesForChain(
if err != nil {
return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("error performing github releases request: %v", err)
}
if res.StatusCode != http.StatusOK {
return builder.HeighlinerQueuedChainBuilds{}, fmt.Errorf("status code: %v", res.StatusCode)
}

defer res.Body.Close()

Expand Down

0 comments on commit 2da0b66

Please sign in to comment.