File: http_handler.go

package info (click to toggle)
golang-gitlab-gitlab-org-labkit 1.17.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: sh: 210; javascript: 49; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package errortracking

import (
	"net/http"

	sentryhttp "github.com/getsentry/sentry-go/http"
)

// NewHandler will recover from panics inside handlers and reports the stacktrace to the errorreporting provider.
func NewHandler(next http.Handler) http.Handler {
	sentryHandler := sentryhttp.New(sentryhttp.Options{
		Repanic:         false,
		WaitForDelivery: true,
	})

	return sentryHandler.Handle(next)
}