Browse Source

Better return status codes for GH webhook

tags/v0.4.0
Russ Garrett 5 years ago
parent
commit
aa31db726e
No account linked to committer's email address
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      httplistener/github.go

+ 5
- 1
httplistener/github.go View File

@@ -34,8 +34,12 @@ func (hl *HTTPListener) githubHandler(w http.ResponseWriter, request *http.Reque
34 34
 		github.PullRequestEvent)
35 35
 
36 36
 	if err != nil {
37
-		// This usually happens because we've received an event we don't need to handle.
37
+		if err == github.ErrEventNotFound {
38
+			// We've received an event we don't need to handle, return normally
39
+			return
40
+		}
38 41
 		log.Warningf("Error parsing github webhook: %s", err)
42
+		http.Error(w, "Error processing webhook", http.StatusBadRequest)
39 43
 		return
40 44
 	}
41 45
 

Loading…
Cancel
Save