1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/vendor/github.com/tobi/airbrake-go/handler.go

18 lines
410 B
Go
Raw Normal View History

2015-09-30 03:21:17 +02:00
package airbrake
import (
"net/http"
)
// CapturePanicHandler "middleware".
// Wraps the http handler so that all panics will be dutifully reported to airbrake
//
// 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)
}
}