mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Merge 0825e3c30e
into fd72a814f8
This commit is contained in:
commit
adef4c13c2
|
@ -61,10 +61,10 @@ In order to alter the style of the response, you could write the following custo
|
||||||
|
|
||||||
from rest_framework.views import exception_handler
|
from rest_framework.views import exception_handler
|
||||||
|
|
||||||
def custom_exception_handler(exc, context):
|
def custom_exception_handler(exc, **context):
|
||||||
# Call REST framework's default exception handler first,
|
# Call REST framework's default exception handler first,
|
||||||
# to get the standard error response.
|
# to get the standard error response.
|
||||||
response = exception_handler(exc, context)
|
response = exception_handler(exc, **context)
|
||||||
|
|
||||||
# Now add the HTTP status code to the response.
|
# Now add the HTTP status code to the response.
|
||||||
if response is not None:
|
if response is not None:
|
||||||
|
|
|
@ -54,7 +54,7 @@ def get_view_description(view_cls, html=False):
|
||||||
return description
|
return description
|
||||||
|
|
||||||
|
|
||||||
def exception_handler(exc, context):
|
def exception_handler(exc, **context):
|
||||||
"""
|
"""
|
||||||
Returns the response that should be used for any given exception.
|
Returns the response that should be used for any given exception.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user