XOAUTH2: raise error if string 'error' is in the response

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/374
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-08-23 01:19:30 +02:00
parent 59d254c783
commit 38c6785636

View File

@ -264,6 +264,9 @@ class IMAPServer(object):
resp = json.loads(response)
self.ui.debug('imap', 'xoauth2handler: response "%s"'% resp)
if u'error' in resp:
raise OfflineImapError("xoauth2handler got: %s"% resp,
OfflineImapError.ERROR.REPO)
self.oauth2_access_token = resp['access_token']
self.ui.debug('imap', 'xoauth2handler: access_token "%s"'%