From 9a4eff6820394d0595ce47ee8c0fa575526ca91f Mon Sep 17 00:00:00 2001 From: Muizudeen Kusimo Date: Fri, 16 Oct 2015 15:02:34 -0400 Subject: [PATCH 1/2] Change `context` argument for custom_exception_handler to dictionary --- docs/api-guide/exceptions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/exceptions.md b/docs/api-guide/exceptions.md index 3e4b3e8be..a781ef0aa 100644 --- a/docs/api-guide/exceptions.md +++ b/docs/api-guide/exceptions.md @@ -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 - def custom_exception_handler(exc, context): + def custom_exception_handler(exc, **context): # Call REST framework's default exception handler first, # 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. if response is not None: From 0825e3c30eb0c5225e617f50c1faf7ed90264031 Mon Sep 17 00:00:00 2001 From: Muizudeen Kusimo Date: Fri, 16 Oct 2015 15:03:46 -0400 Subject: [PATCH 2/2] Update signature for exception_handler as per docs here http://www.django-rest-framework.org/api-guide/exceptions/ --- rest_framework/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/views.py b/rest_framework/views.py index 56e3c4e49..457d02549 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -52,7 +52,7 @@ def get_view_description(view_cls, html=False): return description -def exception_handler(exc, context): +def exception_handler(exc, **context): """ Returns the response that should be used for any given exception.