Add sentry panic handler

This commit is contained in:
kolaente 2020-06-18 21:22:42 +02:00
parent 6d1dd80d8c
commit b8e281c50c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 9 additions and 0 deletions

View File

@ -133,6 +133,15 @@ func NewEcho() *echo.Echo {
sentry.CaptureException(err)
e.DefaultHTTPErrorHandler(err, c)
}
// Maybe we don't need a middleware since echo recovers the error and bubbles it up to the error handler where
// sentry catches it?
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
defer sentry.Recover()
return next(c)
}
})
}
// Validation