Also use sentry for capnp exceptions (#20900)
* Also try sentry for capnp exceptions * catch potential exceptions * cloudlog on exception Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>albatross
parent
c08ee575f8
commit
a7b3df5df8
|
@ -1,7 +1,4 @@
|
||||||
"""Install exception handler for process crash."""
|
"""Install exception handler for process crash."""
|
||||||
import sys
|
|
||||||
import capnp
|
|
||||||
|
|
||||||
from selfdrive.swaglog import cloudlog
|
from selfdrive.swaglog import cloudlog
|
||||||
from selfdrive.version import version
|
from selfdrive.version import version
|
||||||
|
|
||||||
|
@ -9,11 +6,13 @@ import sentry_sdk
|
||||||
from sentry_sdk.integrations.threading import ThreadingIntegration
|
from sentry_sdk.integrations.threading import ThreadingIntegration
|
||||||
|
|
||||||
def capture_exception(*args, **kwargs):
|
def capture_exception(*args, **kwargs):
|
||||||
exc_info = sys.exc_info()
|
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
|
||||||
if not exc_info[0] is capnp.lib.capnp.KjException:
|
|
||||||
|
try:
|
||||||
sentry_sdk.capture_exception(*args, **kwargs)
|
sentry_sdk.capture_exception(*args, **kwargs)
|
||||||
sentry_sdk.flush() # https://github.com/getsentry/sentry-python/issues/291
|
sentry_sdk.flush() # https://github.com/getsentry/sentry-python/issues/291
|
||||||
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
|
except Exception:
|
||||||
|
cloudlog.exception("sentry exception")
|
||||||
|
|
||||||
def bind_user(**kwargs):
|
def bind_user(**kwargs):
|
||||||
sentry_sdk.set_user(kwargs)
|
sentry_sdk.set_user(kwargs)
|
||||||
|
|
Loading…
Reference in New Issue