Skip to content

Commit

Permalink
Added Django setting to ignore expected Celery errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoffman34 authored and dcramer committed Sep 16, 2017
1 parent 9628198 commit d796576
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/integrations/django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ Additional Settings
'CELERY_LOGLEVEL': logging.INFO
}

.. describe:: SENTRY_CELERY_IGNORE_EXPECTED

If you are also using Celery, then you can ignore expected exceptions by
setting this to ``True``. This will cause exception classes in
``Task.throws`` to be ignored.

Caveats
-------

Expand Down
8 changes: 7 additions & 1 deletion raven/contrib/django/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ def install_celery(self):
SentryCeleryHandler, register_logger_signal
)

self.celery_handler = SentryCeleryHandler(client).install()
ignore_expected = getattr(settings,
'SENTRY_CELERY_IGNORE_EXPECTED',
False)

self.celery_handler = SentryCeleryHandler(client,
ignore_expected=ignore_expected)\
.install()

# try:
# ga = lambda x, d=None: getattr(settings, 'SENTRY_%s' % x, d)
Expand Down

0 comments on commit d796576

Please sign in to comment.