diff --git a/src/drivers/Socket.py b/src/drivers/Socket.py index 0017c6d20..7f8087400 100644 --- a/src/drivers/Socket.py +++ b/src/drivers/Socket.py @@ -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.')