omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Allow exception handling during DEBUG mode #1118

Open bhch opened 5 years ago

bhch commented 5 years ago

Exceptions should be handled even when DEBUG = True.

Consider the NotAllowedToDisconnect exception. This exception is very closely related to the application UX. It is an expected exception. What I mean is, as a developer, I know that if a user tries to disconnect without providing a password, this exception will be raised. So I'll have to write appropriate code to prepare for that case, like to redirect user to a certain page or ask them to set a password.

This is part of the development process. But right now, I have to turn off DEBUG mode or override SocialAuthExceptionMiddleware.raise_exception to write code for this scenario.