Last active
January 17, 2023 15:17
-
-
Save morenoh149/ff28d0397075e168ba596992e3ab5170 to your computer and use it in GitHub Desktop.
django ignore db errors in sentry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sentry docs for filtering errors | |
# https://docs.sentry.io/platforms/python/guides/django/configuration/filtering/#event-hints | |
from django.urls import reverse_lazy | |
from django.db.utils import InterfaceError as djangoDbInterfaceError | |
... | |
def before_send(event, hint): | |
if 'exc_info' in hint: | |
exc_type, exc_value, tb = hint['exc_info'] | |
if isinstance(exc_value, (ValidationError, djangoDbInterfaceError, )): | |
return None | |
return event |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment