1
0
mirror of https://github.com/OfflineIMAP/offlineimap.git synced 2024-07-05 08:51:00 +02:00

Drop connection if it might be bad on APPEND

1) Differentiate error messages between imaplib.abort and imaplib.error
exceptions in the log.

2) Drop connections in the case of imapobj.error, it also might denote a
   broken connection.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-11-02 10:27:08 +01:00
parent 006f19aba9
commit 656405616d

View File

@ -540,17 +540,19 @@ class IMAPFolder(BaseFolder):
imapobj = self.imapserver.acquireconnection()
if not retry_left:
raise OfflineImapError("Saving msg in folder '%s', "
"repository '%s' failed. Server reponded: %s\n"
"repository '%s' failed (abort). Server reponded: %s\n"
"Message content was: %s" %
(self, self.getrepository(), str(e), dbg_output),
OfflineImapError.ERROR.MESSAGE)
self.ui.error(e, exc_info()[2])
except imapobj.error, e: # APPEND failed
# If the server responds with 'BAD', append()
# raise()s directly. So we catch that too.
# drop conn, it might be bad.
self.imapserver.releaseconnection(imapobj, True)
imapobj = None
raise OfflineImapError("Saving msg folder '%s', repo '%s'"
"failed. Server reponded: %s\nMessage content was: "
"failed (error). Server reponded: %s\nMessage content was: "
"%s" % (self, self.getrepository(), str(e), dbg_output),
OfflineImapError.ERROR.MESSAGE)
# Checkpoint. Let it write out stuff, etc. Eg searches for