From: Matías Aguirre Date: Tue, 1 Feb 2011 03:09:56 +0000 (-0200) Subject: Show facebook error properly X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=274741adc51c5bc8dbe00cd9dda19ae20459c7b0;p=django-social-auth.git Show facebook error properly --- diff --git a/social_auth/backends/facebook.py b/social_auth/backends/facebook.py index b79a878..c73650e 100644 --- a/social_auth/backends/facebook.py +++ b/social_auth/backends/facebook.py @@ -61,16 +61,15 @@ class FacebookAuth(BaseOAuth): data = self.user_data(access_token) if data is not None: if 'error' in data: - raise ValueError('Authentication error') + error = self.data.get('error') or 'unknown error' + raise ValueError('Authentication error: %s' % error) data['access_token'] = access_token data['expires'] = response['expires'][0] kwargs.update({'response': data, FacebookBackend.name: True}) return authenticate(*args, **kwargs) else: - description = self.data['error'] \ - if self.data.get('error') \ - else 'unknown_error' - raise ValueError(description) + error = self.data.get('error') or 'unknown error' + raise ValueError('Authentication error: %s' % error) def user_data(self, access_token): """Loads user data from service"""