Socket: Remove misleading error fallback for Python <3.4.

We no longer support this Python version.

Fixes GH-1412.
This commit is contained in:
Valentin Lorentz 2020-05-26 23:00:40 +02:00
parent b4df468b3a
commit d56e8ef73d

View File

@ -412,9 +412,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
trusted_fingerprints=network_config.ssl.serverFingerprints(),
ca_file=network_config.ssl.authorityCertificate(),
)
except getattr(ssl, 'CertificateError', None) as e:
# Default to None for old Python version, which do not have
# CertificateError
except ssl.CertificateError as e:
drivers.log.error(('Certificate validation failed when '
'connecting to %s: %s\n'
'This means either someone is doing a man-in-the-middle '
@ -423,15 +421,6 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
% (self.irc.network, e.args[0]))
raise ssl.SSLError('Aborting because of failed certificate '
'verification.')
except ssl.SSLError as e:
drivers.log.error(('Certificate validation failed when '
'connecting to %s: %s\n'
'This means either someone is doing a man-in-the-middle '
'attack on your connection, or the server\'s '
'certificate is not trusted.')
% (self.irc.network, e.args[1]))
raise ssl.SSLError('Aborting because of failed certificate '
'verification.')