mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 06:14:47 +03:00
Merge 6c6d926cb3
into d404597e0b
This commit is contained in:
commit
730fe5a69d
|
@ -425,10 +425,8 @@ class APIView(View):
|
||||||
else:
|
else:
|
||||||
exc.status_code = status.HTTP_403_FORBIDDEN
|
exc.status_code = status.HTTP_403_FORBIDDEN
|
||||||
|
|
||||||
exception_handler = self.settings.EXCEPTION_HANDLER
|
|
||||||
|
|
||||||
context = self.get_exception_handler_context()
|
context = self.get_exception_handler_context()
|
||||||
response = exception_handler(exc, context)
|
response = self._get_error_response(exc, context)
|
||||||
|
|
||||||
if response is None:
|
if response is None:
|
||||||
raise
|
raise
|
||||||
|
@ -436,6 +434,9 @@ class APIView(View):
|
||||||
response.exception = True
|
response.exception = True
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def _get_error_response(self, exc, context):
|
||||||
|
return self.settings.EXCEPTION_HANDLER(exc, context)
|
||||||
|
|
||||||
# Note: Views are made CSRF exempt from within `as_view` as to prevent
|
# Note: Views are made CSRF exempt from within `as_view` as to prevent
|
||||||
# accidental removal of this exemption in cases where `dispatch` needs to
|
# accidental removal of this exemption in cases where `dispatch` needs to
|
||||||
# be overridden.
|
# be overridden.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user