diff options
Diffstat (limited to 'internal/sentryhttp/http.go')
-rw-r--r-- | internal/sentryhttp/http.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/sentryhttp/http.go b/internal/sentryhttp/http.go new file mode 100644 index 0000000..7897b81 --- /dev/null +++ b/internal/sentryhttp/http.go @@ -0,0 +1,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)) +} |