mozilla/django-browserid — pull request #254 by tkrajina (2014-06-07 06:59:39+00:00)
Title: Handle all exceptions from auth.authenticate()

At the moment when auth.authenticate() throws an Exception the user gets only:

[07/Jun/2014 06:45:35] "POST /browserid/login/ HTTP/1.1" 500 17

...in the logs. Because django_browserid handles only BrowserIDException, but django.contrib.auth will throw django Exceptions. Those won't be catched here and the exception message and stacktrace is lost.

This pull-request is just an idea, maybe a better solution would be to handle differently:

* django.core.exceptions.PermissionDenied -- log it ant throw *403*, and
* all other Exceptions (log it and throw *500*).

What do you think?