#34430: Custom exception handler not called
-------------------------------------------+------------------------
               Reporter:  frontierconnect  |          Owner:  nobody
                   Type:  Uncategorized    |         Status:  new
              Component:  Generic views    |        Version:  4.1
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 coded my own method custom_exception_handler for exception handling but
 for authentication exception this callback is not called

 I configured in my settings the callback under:

 REST_FRAMEWORK = {'EXCEPTION_HANDLER' :
 'myapp.api.response.custom_exception_handler',}

 Simple performing a api call without token (that requires auth), it is
 raised NotAuthenticated exception, that is returning on Response

 {"detail":"Authentication credentials were not provided."}

 My view class is inherited from rest_framework.viewsets.GenericViewSet
 that inherits APIView

 I noticed that the exception handler callback is managed in APIView

 exception_handler = self.get_exception_handler()

 that returns settings.EXCEPTION_HANDLER that pointing to default
 rest_framework exception handler.

 Seems that REST_FRAMEWORK configuration is not taken into account.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34430>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701870597c934-6b9bfc66-c826-4829-a64f-cc6b2c9f84ff-000000%40eu-central-1.amazonses.com.

Reply via email to