diff options
| author | José Padilla | 2014-12-13 18:18:00 -0400 | 
|---|---|---|
| committer | José Padilla | 2014-12-13 18:18:00 -0400 | 
| commit | 0d109c90a74bc575efa6d497a6501aef2b837983 (patch) | |
| tree | a39437799fe8b67f84343826e4bf316849b77784 /rest_framework/views.py | |
| parent | dd712a1c2620b5dc9ad8eef5ff78ef232feb12e8 (diff) | |
| download | django-rest-framework-0d109c90a74bc575efa6d497a6501aef2b837983.tar.bz2 | |
Add context to exception handler #2236
Same context as renderers which include: the view,
args, kwargs, and request.
This provides enough contextual information to the
exception handlers to handle errors better.
In a use case like #1671, a custom handler
would allow Sentry to log the request properly.
Diffstat (limited to 'rest_framework/views.py')
| -rw-r--r-- | rest_framework/views.py | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/rest_framework/views.py b/rest_framework/views.py index bc870417..07e71393 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -46,7 +46,7 @@ def get_view_description(view_cls, html=False):      return description -def exception_handler(exc): +def exception_handler(exc, context=None):      """      Returns the response that should be used for any given exception. @@ -369,7 +369,8 @@ class APIView(View):              else:                  exc.status_code = status.HTTP_403_FORBIDDEN -        response = self.settings.EXCEPTION_HANDLER(exc) +        context = self.get_renderer_context() +        response = self.settings.EXCEPTION_HANDLER(exc, context)          if response is None:              raise | 
