From e717b69139a96a9b7b587b5e11f9399b99a4d1bf Mon Sep 17 00:00:00 2001 From: Jakub Date: Tue, 21 Dec 2021 10:48:50 +0100 Subject: [PATCH] GODT-1483: correct scope in sentry report --- internal/sentry/reporter.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/sentry/reporter.go b/internal/sentry/reporter.go index 319f4119..ec1ffcbe 100644 --- a/internal/sentry/reporter.go +++ b/internal/sentry/reporter.go @@ -61,17 +61,21 @@ func NewReporter(appName, appVersion string, userAgent fmt.Stringer) *Reporter { } func (r *Reporter) ReportException(i interface{}) error { + SkipDuringUnwind() return r.ReportExceptionWithContext(i, make(map[string]interface{})) } func (r *Reporter) ReportMessage(msg string) error { + SkipDuringUnwind() return r.ReportMessageWithContext(msg, make(map[string]interface{})) } func (r *Reporter) ReportExceptionWithContext(i interface{}, context map[string]interface{}) error { - err := fmt.Errorf("recover: %v", i) + SkipDuringUnwind() + err := fmt.Errorf("recover: %v", i) return r.scopedReport(context, func() { + SkipDuringUnwind() if eventID := sentry.CaptureException(err); eventID != nil { logrus.WithError(err). WithField("reportID", *eventID). @@ -81,7 +85,9 @@ func (r *Reporter) ReportExceptionWithContext(i interface{}, context map[string] } func (r *Reporter) ReportMessageWithContext(msg string, context map[string]interface{}) error { + SkipDuringUnwind() return r.scopedReport(context, func() { + SkipDuringUnwind() if eventID := sentry.CaptureMessage(msg); eventID != nil { logrus.WithField("message", msg). WithField("reportID", *eventID).