forked from Silverfish/proton-bridge
GODT-1483: correct scope in sentry report
This commit is contained in:
@ -61,17 +61,21 @@ func NewReporter(appName, appVersion string, userAgent fmt.Stringer) *Reporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reporter) ReportException(i interface{}) error {
|
func (r *Reporter) ReportException(i interface{}) error {
|
||||||
|
SkipDuringUnwind()
|
||||||
return r.ReportExceptionWithContext(i, make(map[string]interface{}))
|
return r.ReportExceptionWithContext(i, make(map[string]interface{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reporter) ReportMessage(msg string) error {
|
func (r *Reporter) ReportMessage(msg string) error {
|
||||||
|
SkipDuringUnwind()
|
||||||
return r.ReportMessageWithContext(msg, make(map[string]interface{}))
|
return r.ReportMessageWithContext(msg, make(map[string]interface{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reporter) ReportExceptionWithContext(i interface{}, context map[string]interface{}) error {
|
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() {
|
return r.scopedReport(context, func() {
|
||||||
|
SkipDuringUnwind()
|
||||||
if eventID := sentry.CaptureException(err); eventID != nil {
|
if eventID := sentry.CaptureException(err); eventID != nil {
|
||||||
logrus.WithError(err).
|
logrus.WithError(err).
|
||||||
WithField("reportID", *eventID).
|
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 {
|
func (r *Reporter) ReportMessageWithContext(msg string, context map[string]interface{}) error {
|
||||||
|
SkipDuringUnwind()
|
||||||
return r.scopedReport(context, func() {
|
return r.scopedReport(context, func() {
|
||||||
|
SkipDuringUnwind()
|
||||||
if eventID := sentry.CaptureMessage(msg); eventID != nil {
|
if eventID := sentry.CaptureMessage(msg); eventID != nil {
|
||||||
logrus.WithField("message", msg).
|
logrus.WithField("message", msg).
|
||||||
WithField("reportID", *eventID).
|
WithField("reportID", *eventID).
|
||||||
|
|||||||
Reference in New Issue
Block a user