Copyright 2019 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package middleware

import (
	

	
)
Panic returns a middleware that executes panicHandler on any panic originating from the delegate handler.
func ( http.Handler) Middleware {
	return func( http.Handler) http.Handler {
		return http.HandlerFunc(func( http.ResponseWriter,  *http.Request) {
			defer func() {
				if  := recover();  != nil {
					log.Errorf(.Context(), "middleware.Panic: %v", )
					.ServeHTTP(, )
				}
			}()
			.ServeHTTP(, )
		})
	}