Skip to content

Commit

Permalink
Raising a custom KeyError when 'access_token' is missing, see #134
Browse files Browse the repository at this point in the history
  • Loading branch information
flashingpumpkin committed Jan 9, 2012
1 parent 038b8af commit 6da77f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion socialregistration/clients/oauth.py
Expand Up @@ -270,7 +270,13 @@ def get_access_token(self, code=None, **params):
if self._access_token is None:
if code is None:
raise ValueError(_('Invalid code.'))
self._access_token = self._get_access_token(code, **params)['access_token']

access_token_dict = self._get_access_token(code, **params)
try:
self._access_token = access_token_dict['access_token']
except KeyError, e:
raise KeyError("'access_token_dict' contains no key 'access_token': %s" % access_token_dict)

return self._access_token

def complete(self, GET):
Expand Down

0 comments on commit 6da77f7

Please sign in to comment.