gitlab.com/gitlab-org/labkit@v1.21.0/errortracking/http_handler.go (about)

     1  package errortracking
     2  
     3  import (
     4  	"net/http"
     5  
     6  	sentryhttp "github.com/getsentry/sentry-go/http"
     7  )
     8  
     9  // NewHandler will recover from panics inside handlers and reports the stacktrace to the errorreporting provider.
    10  func NewHandler(next http.Handler) http.Handler {
    11  	sentryHandler := sentryhttp.New(sentryhttp.Options{
    12  		Repanic:         false,
    13  		WaitForDelivery: true,
    14  	})
    15  
    16  	return sentryHandler.Handle(next)
    17  }