internal/sentryhttp/http.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package sentryhttp
import (
"net/http"
sentryhttp "github.com/getsentry/sentry-go/http"
)
type ServeMux struct {
sentryHandler *sentryhttp.Handler
*http.ServeMux
}
func NewServeMux() *ServeMux {
return &ServeMux{
sentryHandler: sentryhttp.New(sentryhttp.Options{
Repanic: true,
}),
ServeMux: http.NewServeMux(),
}
}
func (sm *ServeMux) Handle(pattern string, handler http.Handler) {
sm.ServeMux.Handle(pattern, sm.sentryHandler.Handle(handler))
}
func (sm *ServeMux) HandleFunc(pattern string, handler http.HandlerFunc) {
sm.ServeMux.HandleFunc(pattern, sm.sentryHandler.HandleFunc(handler))
}
|