jpadilla / django-rest-framework-jwt

JSON Web Token Authentication support for Django REST Framework
http://jpadilla.github.io/django-rest-framework-jwt/
MIT License
3.19k stars 649 forks source link

I'd like to be able to use a custom exception handler #364

Open ideallical opened 7 years ago

ideallical commented 7 years ago

Currently it's not possible to use a custom exception handler of DRF without overriding the JSONWebTokenAPIView.

It's in line 55 of rest_framework_jwt/views.py where I'd like to change:

if serializer.is_valid():

Into:

if serializer.is_valid(raise_exception=True):

My suggest fix would be to make this a setting like so:

if serializer.is_valid(raise_exception=api_settings.JWT_RAISE_EXCEPTION):

Where JWT_RAISE_EXCEPTION defaults to True for backwards compatibility.