Merge pull request #36 from patrickdepinguin/exception

imapserver: fix exception handling in xoauth2handler
This commit is contained in:
Rodolfo García Peñas (kix) 2021-01-05 09:55:15 +01:00 committed by GitHub
commit 00d395b746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,7 +254,8 @@ class IMAPServer:
except Exception as eparams:
msg = "%s [cannot display configuration: %s]" % (e, eparams)
raise type(e)(msg, exc_info()[2])
self.ui.error(msg)
raise
finally:
socket.socket = original_socket
@ -660,7 +661,7 @@ class IMAPServer:
% (self.hostname, self.repos, e)
raise OfflineImapError(reason, severity, exc_info()[2])
elif isinstance(e, socket.error) and e.args[0] == errno.ECONNREFUSED:
elif isinstance(e, socket.error) and e.args and e.args[0] == errno.ECONNREFUSED:
# "Connection refused", can be a non-existing port, or an unauthorized
# webproxy (open WLAN?)
reason = "Connection to host '%s:%d' for repository '%s' was " \