From ce83efc3c7de6432c9af146fe1ed61204497f2a6 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Wed, 14 Jun 2017 09:28:22 +0200 Subject: [PATCH] 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 --- offlineimap/folder/IMAP.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index aa17c1a..b8929b4 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -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