Update error code used for panics

This commit is contained in:
David Dworken 2023-09-30 07:25:22 -07:00
parent 6539f834c7
commit f3764b2545
No known key found for this signature in database

View File

@ -114,7 +114,8 @@ func withPanicGuard() Middleware {
defer func() {
if r := recover(); r != nil {
fmt.Printf("panic: %s\n", r)
rw.WriteHeader(http.StatusInternalServerError)
// Note that we need to return a 503 error code since that is the error handled by the client in lib.IsOfflineError
rw.WriteHeader(http.StatusServiceUnavailable)
}
}()
h.ServeHTTP(rw, r)