Handle connection refused messages

This patch handle the connection refused messages. One of these messages
is related to returned zeros.
This commit is contained in:
Rodolfo García Peñas (kix) 2021-08-07 20:33:06 +02:00
parent 81bd57e434
commit 48f2df4267
1 changed files with 7 additions and 0 deletions

View File

@ -677,6 +677,13 @@ class IMAPServer:
"for repository '%s'. Remote does not answer." % (self.hostname, self.repos),
OfflineImapError.ERROR.REPO,
exc_info()[2])
elif e.args and \
e.args[0][:35] == 'IMAP4 protocol error: socket error:':
raise OfflineImapError(
"Could not connect to remote server '{}' "
"for repository '{}'. Connection Refused.".format(
self.hostname, self.repos),
OfflineImapError.ERROR.CRITICAL)
else:
# re-raise all other errors
raise