no UIDPLUS: improve logging on failures

When there is not UIDPLUS we have to figure the UID by our means. When this
process fails, we don't know if the email was successfully uploaded. This patch
provides better logs to explain what happened.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-11-07 15:07:26 +01:00
parent 681e271fc0
commit 9805d3e7af

View File

@ -722,10 +722,11 @@ class IMAPFolder(BaseFolder):
OfflineImapError.ERROR.MESSAGE)
if uid == 0:
self.ui.warn("savemessage: Server supports UIDPLUS, but"
" we got no usable uid back. APPENDUID reponse was "
" we got no usable UID back. APPENDUID reponse was "
"'%s'"% str(resp))
else:
# We don't support UIDPLUS.
try:
# We don't use UIDPLUS.
uid = self.__savemessage_searchforheader(imapobj, headername,
headervalue)
# See docs for savemessage in Base.py for explanation
@ -738,6 +739,15 @@ class IMAPFolder(BaseFolder):
self.ui.warn("savemessage: Searching mails for new "
"Message-ID failed. Could not determine new UID "
"on %s."% self.getname())
# Something wrong happened while trying to get the UID. Explain
# the error might be about the 'get UID' process not necesseraly
# the APPEND.
except Exception:
self.ui.warn("%s: could not determine the UID while we got "
"no error while appending the email with '%s: %s'"%
(self.getname(), headername, headervalue)
)
raise
finally:
if imapobj:
self.imapserver.releaseconnection(imapobj)