Recover from panic during requests

This commit is contained in:
Matthew Holt 2015-03-26 22:52:27 -06:00
parent 2fbfafc408
commit 1146a9b90b

View file

@ -101,6 +101,11 @@ func (s *Server) Serve() error {
// ServeHTTP is the entry point for each request to s.
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() {
if rec := recover(); rec != nil {
log.Printf("[PANIC] '%s': %s", r.URL.String(), rec)
}
}()
s.stack(w, r)
}