  class TestCustomExceptionHandler(TestCase):
      def setUp(self):
          self.DEFAULT_HANDLER = api_settings.EXCEPTION_HANDLER
  
          def exception_handler(exc):
              return Response('Error!', status=status.HTTP_400_BAD_REQUEST)
  
          api_settings.EXCEPTION_HANDLER = exception_handler
  
      def tearDown(self):
 
</s> remove def exception_handler(exc):
 </s> add def exception_handler(exc, context=None): </s> remove         response = self.settings.EXCEPTION_HANDLER(exc)
 </s> add         context = self.get_renderer_context()
        response = self.settings.EXCEPTION_HANDLER(exc, context)
        def exception_handler(exc, context=None):
            self.assertTrue('args' in context)
            self.assertTrue('kwargs' in context)
            self.assertTrue('request' in context)
            self.assertTrue('view' in context)

  class TestCustomExceptionHandler(TestCase):
      def setUp(self):
          self.DEFAULT_HANDLER = api_settings.EXCEPTION_HANDLER
  
        def exception_handler(exc, context=None):
            self.assertTrue('args' in context)
            self.assertTrue('kwargs' in context)
            self.assertTrue('request' in context)
            self.assertTrue('view' in context)

              return Response('Error!', status=status.HTTP_400_BAD_REQUEST)
  
          api_settings.EXCEPTION_HANDLER = exception_handler
  
      def tearDown(self):
keep keep keep keep replace keep keep keep keep keep
 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. 
tests/test_views.py