Closed houmie closed 11 years ago
try setting DEBUG = False. middleware won't handle the exceptions if DEBUG = True. and see issue 662 with suggested fix.
In practice, how I deal with this problem? Do I need to fork the project and catch the exception myself? Thanks
@gfronza, use a middleware to process it, you can subclass the middleware defined on this app (https://github.com/omab/django-social-auth/blob/master/social_auth/middleware.py)
@omab Hmm, since IntegrityError is not a subclass of SocialAuthBaseException, do you think it's healthy to catch it there. Any IntegrityError thrown in my application wil be considered as a login/signup error. I think you could give us a base exception for that. Thanks!
Even if IntegrityError
is not a subclass of SocialAuthBaseException
, you could check for request.social_auth_backend
to identify if the current issue was raised by some DSA view. It's not the cleanest solution, but I prefer that than hide the real exception with another.
Good idea @omab. But yesterday I came up with another solution. I've wrapped the DSA url include with an exception handler function. Something like...
urlpatterns = required(
social_auth_exception_handler,
patterns('', (r'', include('social_auth.urls')),)
)
After hours of debugging and inconsistent behaviour I figured out the problem.
My super user had the same email as the facebook account I was trying to login with. Hence the new user could not be generated with the same email address. The result was an exception here:
Only after commenting out the try except, I was able to see the problem of having there same email address twice. Despite having defined the following below, I couldn't see the thrown exception in my template, but maybe I am missing something:
Setting.py:
Url:
error.html