mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-29 07:03:48 +03:00
Recover from panic during requests
This commit is contained in:
parent
2fbfafc408
commit
1146a9b90b
1 changed files with 5 additions and 0 deletions
|
@ -101,6 +101,11 @@ func (s *Server) Serve() error {
|
||||||
|
|
||||||
// ServeHTTP is the entry point for each request to s.
|
// ServeHTTP is the entry point for each request to s.
|
||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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)
|
s.stack(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue