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:
parent
681e271fc0
commit
9805d3e7af
@ -722,22 +722,32 @@ class IMAPFolder(BaseFolder):
|
|||||||
OfflineImapError.ERROR.MESSAGE)
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
if uid == 0:
|
if uid == 0:
|
||||||
self.ui.warn("savemessage: Server supports UIDPLUS, but"
|
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))
|
"'%s'"% str(resp))
|
||||||
else:
|
else:
|
||||||
# We don't support UIDPLUS.
|
try:
|
||||||
uid = self.__savemessage_searchforheader(imapobj, headername,
|
# We don't use UIDPLUS.
|
||||||
headervalue)
|
uid = self.__savemessage_searchforheader(imapobj, headername,
|
||||||
# See docs for savemessage in Base.py for explanation
|
|
||||||
# of this and other return values.
|
|
||||||
if uid == 0:
|
|
||||||
self.ui.debug('imap', 'savemessage: attempt to get new UID '
|
|
||||||
'UID failed. Search headers manually.')
|
|
||||||
uid = self.__savemessage_fetchheaders(imapobj, headername,
|
|
||||||
headervalue)
|
headervalue)
|
||||||
self.ui.warn("savemessage: Searching mails for new "
|
# See docs for savemessage in Base.py for explanation
|
||||||
"Message-ID failed. Could not determine new UID "
|
# of this and other return values.
|
||||||
"on %s."% self.getname())
|
if uid == 0:
|
||||||
|
self.ui.debug('imap', 'savemessage: attempt to get new UID '
|
||||||
|
'UID failed. Search headers manually.')
|
||||||
|
uid = self.__savemessage_fetchheaders(imapobj, headername,
|
||||||
|
headervalue)
|
||||||
|
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:
|
finally:
|
||||||
if imapobj:
|
if imapobj:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
|
Loading…
Reference in New Issue
Block a user