blob: 5cd0dea17091125a82e465ae0ecdf6878f4b4f62 [file] [log] [blame]
package airbrake
import (
"net/http"
)
// CapturePanicHandler "middleware".
// Wraps the http handler so that all panics will be dutifully reported to airbreak
//
// Example:
// http.HandleFunc("/", airbrake.CapturePanicHandler(MyServerFunc))
func CapturePanicHandler(app http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
defer CapturePanic(r)
app(w, r)
}
}