Skip to content

Commit 2212d4c

Browse files
authored
Merge pull request #11 from rsvoboda/more.context.logging
Provide more details in error message when GH retuns unexpected HTTP status code
2 parents 9492dc1 + 60d2bf1 commit 2212d4c

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

metrics/get_billable_from_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func GetBillableFromGithub() {
5656
log.Fatal(err)
5757
}
5858
if resp.StatusCode != 200 {
59-
log.Fatalf("the status code returned by the server is different from 200: %d", resp.StatusCode)
59+
log.Fatalf("the status code returned by the server for workflows in repo %s is different from 200: %d", repo, resp.StatusCode)
6060
}
6161
err = json.NewDecoder(resp.Body).Decode(&bill)
6262
if err != nil {

metrics/get_jobs_from_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func GetJobsFromGithub() {
5353
log.Fatal(err)
5454
}
5555
if resp.StatusCode != 200 {
56-
log.Fatalf("the status code returned by the server is different from 200: %d", resp.StatusCode)
56+
log.Fatalf("the status code returned by the server for runs in repo %s is different from 200: %d", repo, resp.StatusCode)
5757
}
5858
err = json.NewDecoder(resp.Body).Decode(&p)
5959
if err != nil {

metrics/get_runners_from_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func GetRunnersFromGithub() {
4848
log.Fatal(err)
4949
}
5050
if resp.StatusCode != 200 {
51-
log.Fatalf("the status code returned by the server is different from 200: %d", resp.StatusCode)
51+
log.Fatalf("the status code returned by the server for runners in repo %s is different from 200: %d", repo, resp.StatusCode)
5252
}
5353
err = json.NewDecoder(resp.Body).Decode(&p)
5454
if err != nil {

metrics/get_runners_organization_from_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func GetRunnersOrganizationFromGithub() {
4141
log.Fatal(err)
4242
}
4343
if resp.StatusCode != 200 {
44-
log.Fatalf("the status code returned by the server is different from 200: %d", resp.StatusCode)
44+
log.Fatalf("the status code returned by the server for runners in organization %s is different from 200: %d", orga, resp.StatusCode)
4545
}
4646
err = json.NewDecoder(resp.Body).Decode(&p)
4747
if err != nil {

metrics/worflows_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func WorkflowsCache() {
3737
log.Fatal(err)
3838
}
3939
if resp.StatusCode != 200 {
40-
log.Fatalf("the status code returned by the server is different from 200: %d", resp.StatusCode)
40+
log.Fatalf("the status code returned by the server for workflows in repo %s is different from 200: %d", repo, resp.StatusCode)
4141
}
4242
err = json.NewDecoder(resp.Body).Decode(&p)
4343
if err != nil {

0 commit comments

Comments
 (0)