diff options
author | David Cramer <dcramer@gmail.com> | 2010-10-19 10:22:53 -0700 |
---|---|---|
committer | David Cramer <dcramer@gmail.com> | 2010-10-19 10:22:53 -0700 |
commit | 59701a74d556c58ef3b42fd39944ff5d58580a40 (patch) | |
tree | 1867d4a0254ac2c0400d7d3ed92830e85fe8f521 /README.rst | |
parent | 9b0e9874ecd984dc6e9ccc80fc05ebeca2ea0907 (diff) | |
download | raven-59701a74d556c58ef3b42fd39944ff5d58580a40.tar.gz |
Better documentation for use of error handling middleware
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -66,6 +66,36 @@ Finally, run ``python manage.py syncdb`` to create the database tables. (If you use South, you'll need to use ``python manage.py migrate sentry``) +========================= +Error Handling Middleware +========================= + +If you already have middleware in place that handles ``process_exception`` you will need to take extra care when using Sentry. + +For example, the following middleware would suppress Sentry logging due to it returning a response:: + + class MyMiddleware(object): + def process_exception(self, request, exception): + return HttpResponse('foo') + +To work around this, you can either disable your error handling middleware, or add something like the following:: + + from django.core.signals import got_request_exception + class MyMiddleware(object): + def process_exception(self, request, exception): + # Make sure the exception signal is fired for Sentry + got_request_exception.send(sender=self, request=request) + return HttpResponse('foo') + +Or, alternatively, you can just enable Sentry responses:: + + from sentry.client.models import sentry_exception_handler + class MyMiddleware(object): + def process_exception(self, request, exception): + # Make sure the exception signal is fired for Sentry + sentry_exception_handler(request=request) + return HttpResponse('foo') + ========================== Multi-server configuration ========================== |