MM-27613: Update dependencies (#15294)
https://mattermost.atlassian.net/browse/MM-27613
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
54f86e7fb1
Коммит
f2a8e10216
34
vendor/github.com/getsentry/sentry-go/http/sentryhttp.go
сгенерированный
поставляемый
34
vendor/github.com/getsentry/sentry-go/http/sentryhttp.go
сгенерированный
поставляемый
@@ -50,32 +50,28 @@ func New(options Options) *Handler {
|
||||
|
||||
// Handle wraps http.Handler and recovers from caught panics.
|
||||
func (h *Handler) Handle(handler http.Handler) http.Handler {
|
||||
return h.handle(handler)
|
||||
}
|
||||
|
||||
// Deprecated: Use the Handle method instead.
|
||||
func (h *Handler) HandleFunc(handler http.HandlerFunc) http.HandlerFunc {
|
||||
return h.handle(handler)
|
||||
}
|
||||
|
||||
func (h *Handler) handle(handler http.Handler) http.HandlerFunc {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
hub := sentry.CurrentHub().Clone()
|
||||
ctx := r.Context()
|
||||
hub := sentry.GetHubFromContext(ctx)
|
||||
if hub == nil {
|
||||
hub = sentry.CurrentHub().Clone()
|
||||
}
|
||||
hub.Scope().SetRequest(r)
|
||||
ctx := sentry.SetHubOnContext(
|
||||
r.Context(),
|
||||
hub,
|
||||
)
|
||||
ctx = sentry.SetHubOnContext(ctx, hub)
|
||||
defer h.recoverWithSentry(hub, r)
|
||||
handler.ServeHTTP(rw, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
// HandleFunc wraps http.HandleFunc and recovers from caught panics.
|
||||
func (h *Handler) HandleFunc(handler http.HandlerFunc) http.HandlerFunc {
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
hub := sentry.CurrentHub().Clone()
|
||||
hub.Scope().SetRequest(r)
|
||||
ctx := sentry.SetHubOnContext(
|
||||
r.Context(),
|
||||
hub,
|
||||
)
|
||||
defer h.recoverWithSentry(hub, r)
|
||||
handler(rw, r.WithContext(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) recoverWithSentry(hub *sentry.Hub, r *http.Request) {
|
||||
if err := recover(); err != nil {
|
||||
eventID := hub.RecoverWithContext(
|
||||
|
||||
Ссылка в новой задаче
Block a user