folder: IMAP: display error message before starting next try

Fetching messages is tried more than once. Display the error message at correct
time.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-11-22 00:58:14 +01:00
parent 1f635c415f
commit 04ae3c8dad
2 changed files with 6 additions and 4 deletions

View File

@ -736,12 +736,15 @@ class IMAPFolder(BaseFolder):
severity = OfflineImapError.ERROR.MESSAGE
raise OfflineImapError(message,
OfflineImapError.ERROR.MESSAGE)
self.ui.error("%s. While fetching msg %r in folder %r."
" Query: %s Retrying (%d/%d)"% (
e, uids, self.name, query,
retry_num - fails_left, retry_num
)
)
# Release dropped connection, and get a new one.
self.imapserver.releaseconnection(imapobj, True)
imapobj = self.imapserver.acquireconnection()
self.ui.error("%s. While fetching msg %r in folder %r."
" Retrying (%d/%d)"%
(e, uids, self.name, retry_num - fails_left, retry_num))
finally:
# The imapobj here might be different than the one created before
# the ``try`` clause. So please avoid transforming this to a nice