Merge pull request #33 from jeslinmx/httpstatus

Respond with http status 500 upon error
This commit is contained in:
Pierre Dubouilh 2019-09-30 18:21:43 +02:00 committed by GitHub
commit b5965c2199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -1,5 +1,5 @@
name: Go
on: [push]
on: [push, pull_request]
jobs:
build:

View file

@ -57,6 +57,7 @@ func check(e error) {
func exitPath(w http.ResponseWriter, s ...interface{}) {
if r := recover(); r != nil {
log.Println("error", s, r)
w.WriteHeader(500)
w.Write([]byte("error"))
} else if *verb {
log.Println(s...)