folder/IMAP: improve the warning when we can't parse the returned UID

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/479
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-06-14 09:28:22 +02:00
parent 05ff68c7e1
commit ce83efc3c7
1 changed files with 7 additions and 2 deletions

View File

@ -444,6 +444,7 @@ class IMAPFolder(BaseFolder):
# in our way.
result = imapobj.uid('FETCH', bytearray('%d:*'% start), 'rfc822.header')
orig_result = result
if result[0] != 'OK':
raise OfflineImapError('Error fetching mail headers: %s'%
'. '.join(result[1]), OfflineImapError.ERROR.MESSAGE)
@ -463,9 +464,13 @@ class IMAPFolder(BaseFolder):
if uid:
return int(uid.group(1))
else:
self.ui.warn("Can't parse FETCH response, can't find UID: %s", result.__repr__())
self.ui.warn("Can't parse FETCH response, can't find UID: %s"%
repr(orig_result)
)
else:
self.ui.warn("Can't parse FETCH response, we awaited string: %s", result.__repr__())
self.ui.warn("Can't parse FETCH response, we awaited string: %s"%
repr(orig_result)
)
return 0