This repository was archived by the owner on Jan 28, 2021. It is now read-only.
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Feature request: don't die on panic #625
Closed
Description
It would be nice to wrap query handler in defer recover()
so in case a query panics it would return an error to the client instead of server exiting.
Similar to how it usually works with http servers:
func(w http.ResponseWriter, r *http.Request) {
defer func() {
if rp := recover(); rvr != nil {
log.Error("panic %v", rp)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
}()
next.ServeHTTP(w, r) // actual handler
}