Hi,

I read the reference on DRF page on how to add custom exception handler. I 
followed the steps but I couldn't get it working. I removed the setting for 
the custom exception handler and set a breakpoint on the default one (
rest_framework.views.exception_handler).

I have a simple view that only raises an ApiException which should be 
handled by the default exception handler:

@csrf_exempt
def creator(request):
    if request.method == 'POST':
        data = JSONParser().parse(request)
        serializer = CreatorSerializer(data=data)
        raise ParseError("test!!!")
        if serializer.is_valid(raise_exception=True):
            return JsonResponse(serializer.data, status=201)
    return JsonResponse({"message": "NOT FOUND", "status": 404}, status=404)

However, it does not seem that the default exception handler is being used.

I am using djangorestframework==3.10.2

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" 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-rest-framework/6117aa7d-33b0-4055-a915-89a8b0fa61f6%40googlegroups.com.

Reply via email to