From 1460d212ee4a0e2baddb297d52d91af69d58c881 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 13 Apr 2024 21:46:07 +0200 Subject: [PATCH] fix: do not push nil errors to sentry --- pkg/routes/routes.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/routes/routes.go b/pkg/routes/routes.go index e6f4e89fc..429a3f3f0 100644 --- a/pkg/routes/routes.go +++ b/pkg/routes/routes.go @@ -156,10 +156,18 @@ func setupSentry(e *echo.Echo) { if hub != nil { hub.WithScope(func(scope *sentry.Scope) { scope.SetExtra("url", c.Request().URL) - hub.CaptureException(herr.Internal) + if herr.Internal == nil { + hub.CaptureException(err) + } else { + hub.CaptureException(herr.Internal) + } }) } else { - sentry.CaptureException(herr.Internal) + if herr.Internal == nil { + sentry.CaptureException(err) + } else { + sentry.CaptureException(herr.Internal) + } log.Debugf("Could not add context for sending error '%s' to sentry", err.Error()) } log.Debugf("Error '%s' sent to sentry", err.Error())