@@ -33,14 +33,14 @@ func githubHandler(c *http200ok.Context) {
33
33
34
34
if err != nil {
35
35
36
- http . Error ( c . Response , http .StatusText ( http . StatusInternalServerError ), http . StatusInternalServerError )
36
+ render . JSONError ( c , http .StatusInternalServerError , err . Error () )
37
37
38
38
return
39
39
}
40
40
41
41
if err := json .Unmarshal (source , & push ); err != nil {
42
42
43
- http . Error ( c . Response , http .StatusText ( http . StatusBadRequest ), http . StatusBadRequest )
43
+ render . JSONError ( c , http .StatusBadRequest , err . Error () )
44
44
45
45
return
46
46
}
@@ -50,9 +50,9 @@ func githubHandler(c *http200ok.Context) {
50
50
if err != nil {
51
51
52
52
if errors .IsNotFound (err ) {
53
- http . Error ( c . Response , "Project not nound" , http . StatusNotFound )
53
+ render . JSONError ( c , http . StatusNotFound , "Project not nound" )
54
54
} else {
55
- http . Error ( c . Response , http .StatusText ( http . StatusInternalServerError ), http . StatusInternalServerError )
55
+ render . JSONError ( c , http .StatusInternalServerError , err . Error () )
56
56
}
57
57
58
58
return
@@ -64,7 +64,7 @@ func githubHandler(c *http200ok.Context) {
64
64
65
65
if signature == "" {
66
66
67
- http . Error ( c . Response , "Missing X-Hub-Signature header" , http . StatusForbidden )
67
+ render . JSONError ( c , http . StatusForbidden , "Missing X-Hub-Signature header" )
68
68
69
69
return
70
70
}
@@ -76,22 +76,22 @@ func githubHandler(c *http200ok.Context) {
76
76
77
77
if ! hmac .Equal ([]byte (signature [5 :]), []byte (expectedMAC )) {
78
78
79
- http . Error ( c . Response , "HMAC verification failed" , http . StatusForbidden )
79
+ render . JSONError ( c , http . StatusForbidden , "HMAC verification failed" )
80
80
81
81
return
82
82
}
83
83
}
84
84
85
85
if err := github .Push (push ); err != nil {
86
86
87
- http . Error ( c . Response , http .StatusText ( http . StatusInternalServerError ), http . StatusInternalServerError )
87
+ render . JSONError ( c , http .StatusInternalServerError , err . Error () )
88
88
89
89
return
90
90
}
91
91
92
92
case "" :
93
93
94
- http . Error ( c . Response , "Missing X-GitHub-Event header" , http . StatusBadRequest )
94
+ render . JSONError ( c , http . StatusBadRequest , "Missing X-GitHub-Event header" )
95
95
96
96
return
97
97
0 commit comments