correctly reraise errors with six

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-06-29 03:42:57 +02:00
parent 69c0080323
commit 7945e10a76
13 changed files with 139 additions and 86 deletions

View File

@ -139,10 +139,14 @@ class GmailFolder(IMAPFolder):
res_type, response = imapobj.fetch("'%s'"% msgsToFetch,
'(FLAGS X-GM-LABELS UID)')
if res_type != 'OK':
six.reraise(OfflineImapError("FETCHING UIDs in folder [%s]%s failed. " % \
(self.getrepository(), self) + \
"Server responded '[%s] %s'" % \
(res_type, response), OfflineImapError.ERROR.FOLDER), None, exc_info()[2])
six.reraise(OfflineImapError,
OfflineImapError(
"FETCHING UIDs in folder [%s]%s failed. "%
(self.getrepository(), self) +
"Server responded '[%s] %s'"%
(res_type, response),
OfflineImapError.ERROR.FOLDER),
exc_info()[2])
finally:
self.imapserver.releaseconnection(imapobj)