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.")
else:
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:
# Don't support UIDPLUS
# Checkpoint. Let it write out stuff, etc. Eg searches for
@ -596,6 +599,8 @@ class IMAPFolder(BaseFolder):
'UID failed. Search headers manually.')
uid = self.savemessage_fetchheaders(imapobj, headername,
headervalue)
self.ui.warn('imap', "savemessage: Searching mails for new "
"Message-ID failed. Could not determine new UID.")
finally:
self.imapserver.releaseconnection(imapobj)