Advertisement
olegbo

Untitled

May 27th, 2021
1,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. ignore_errors = [
  2.     # TimeLimitExceeded,
  3.     'api.exceptions.OrderError',
  4.     '_mssql.MSSQLDatabaseException',
  5.     'pymssql.DatabaseError',
  6.     'pymssql.OperationalError',
  7.     'django.core.exceptions.ValidationError',
  8. ]
  9.  
  10.  
  11. def before_send(event, hint):
  12.     print(f'before_send: {event} {hint}')
  13.  
  14.     if 'exc_info' in hint:
  15.         exc_type, exc_value, tb = hint['exc_info']
  16.         qname = f'{exc_value.__class__.__module__}.{exc_value.__class__.__name__}'
  17.         print(f'before_send2: {qname}')
  18.         if qname in ignore_errors:
  19.             return None
  20.     return event
  21.  
  22.  
  23. if SENTRY_DSN:
  24.     sentry_sdk.init(
  25.         dsn=SENTRY_DSN,
  26.         before_send=before_send,
  27.         # release=SENTRY_RELEASE,
  28.         environment=SENTRY_ENV,
  29.         integrations=[sentry_logging, DjangoIntegration(), CeleryIntegration(), RedisIntegration()],
  30.         send_default_pii=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement