Skip to content

Commit 1f71e5f

Browse files
committed
error messages
1 parent d7bd68d commit 1f71e5f

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

local/bin/post-commit.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,19 @@ func send(commit Commit) error {
5959
req.Header.Set("X-Token", os.Getenv("TOKEN"))
6060
req.Header.Set("Content-Type", "application/json")
6161

62-
if _, err := client.Do(req); err != nil {
62+
response, err := client.Do(req)
6363

64-
fmt.Printf("Error when sending a commit to Postgres-CI (err: %v)\n", err)
64+
if err != nil {
65+
66+
fmt.Printf("Error when sending a commit to Postgres-CI: %v\n", err)
6567

6668
return nil
6769
}
6870

71+
if response.StatusCode != http.StatusOK {
72+
73+
fmt.Printf("Error when sending a commit to Postgres-CI: %v\n", response.Status)
74+
}
75+
6976
return nil
7077
}

server-side/bin/post-receive.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,19 @@ func send(push git.Push) error {
8181
req.Header.Set("X-Token", os.Getenv("TOKEN"))
8282
req.Header.Set("Content-Type", "application/json")
8383

84-
if _, err := client.Do(req); err != nil {
84+
response, err := client.Do(req)
8585

86-
fmt.Printf("Error when sending a commit to Postgres-CI (err: %v)\n", err)
86+
if err != nil {
87+
88+
fmt.Printf("Error when sending a push to Postgres-CI: %v\n", err)
8789

8890
return nil
8991
}
9092

93+
if response.StatusCode != http.StatusOK {
94+
95+
fmt.Printf("Error when sending a push to Postgres-CI: %s\n", response.Status)
96+
}
97+
9198
return nil
9299
}

0 commit comments

Comments
 (0)