aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/views.py')
-rw-r--r--rest_framework/views.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py
index 71e1fe6c..1afbd697 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -320,13 +320,17 @@ class APIView(View):
self.headers['X-Throttle-Wait-Seconds'] = '%d' % exc.wait
if isinstance(exc, exceptions.APIException):
- return Response({'detail': exc.detail}, status=exc.status_code)
+ return Response({'detail': exc.detail},
+ status=exc.status_code,
+ exception=True)
elif isinstance(exc, Http404):
return Response({'detail': 'Not found'},
- status=status.HTTP_404_NOT_FOUND)
+ status=status.HTTP_404_NOT_FOUND,
+ exception=True)
elif isinstance(exc, PermissionDenied):
return Response({'detail': 'Permission denied'},
- status=status.HTTP_403_FORBIDDEN)
+ status=status.HTTP_403_FORBIDDEN,
+ exception=True)
raise
# Note: session based authentication is explicitly CSRF validated,