folder/IMAP: better error when savemessage fails

If we cannot identify the new UID after a sendmessage(), log a better error
message, including the server response for better debugging.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-02-16 16:49:06 +01:00
parent b69a745417
commit 7da50e638d

View File

@ -577,7 +577,10 @@ class IMAPFolder(BaseFolder):
"appending a message.") "appending a message.")
else: else:
uid = long(resp[-1].split(' ')[1]) uid = long(resp[-1].split(' ')[1])
if uid == 0:
self.ui.warn("savemessage: Server supports UIDPLUS, but"
" we got no usable uid back. APPENDUID reponse was "
"'%s'" % str(resp))
else: else:
# Don't support UIDPLUS # Don't support UIDPLUS
# Checkpoint. Let it write out stuff, etc. Eg searches for # Checkpoint. Let it write out stuff, etc. Eg searches for
@ -593,9 +596,11 @@ class IMAPFolder(BaseFolder):
# compare the message size... # compare the message size...
if uid == 0: if uid == 0:
self.ui.debug('imap', 'savemessage: attempt to get new UID ' self.ui.debug('imap', 'savemessage: attempt to get new UID '
'UID failed. Search headers manually.') 'UID failed. Search headers manually.')
uid = self.savemessage_fetchheaders(imapobj, headername, uid = self.savemessage_fetchheaders(imapobj, headername,
headervalue) headervalue)
self.ui.warn('imap', "savemessage: Searching mails for new "
"Message-ID failed. Could not determine new UID.")
finally: finally:
self.imapserver.releaseconnection(imapobj) self.imapserver.releaseconnection(imapobj)