Commit c79031b2 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[master] Fix exception types caught

parent 6674553c
...@@ -604,7 +604,7 @@ class SecureHTTPServer(socketserver_mixin.NoPollMixIn, ...@@ -604,7 +604,7 @@ class SecureHTTPServer(socketserver_mixin.NoPollMixIn,
self.close_request(sock) self.close_request(sock)
logger.error(CMDCTL_SSL_SETUP_FAILURE_USER_DENIED, err) logger.error(CMDCTL_SSL_SETUP_FAILURE_USER_DENIED, err)
raise raise
except (CmdctlException, IOError) as cce: except (CmdctlException, IOError, socket.error) as cce:
self.close_request(sock) self.close_request(sock)
logger.error(CMDCTL_SSL_SETUP_FAILURE_READING_CERT, cce) logger.error(CMDCTL_SSL_SETUP_FAILURE_READING_CERT, cce)
raise raise
......
...@@ -737,7 +737,7 @@ class TestSecureHTTPServer(unittest.TestCase): ...@@ -737,7 +737,7 @@ class TestSecureHTTPServer(unittest.TestCase):
'no_such_file', 'no_such_file') 'no_such_file', 'no_such_file')
# Using a non-certificate file would cause an SSLError # Using a non-certificate file would cause an SSLError
self.assertRaises(ssl.SSLError, self.assertRaises(socket.error,
self.server._wrap_socket_in_ssl_context, self.server._wrap_socket_in_ssl_context,
sock, sock,
BUILD_FILE_PATH + 'cmdctl.py', BUILD_FILE_PATH + 'cmdctl.py',
...@@ -756,7 +756,7 @@ class TestSecureHTTPServer(unittest.TestCase): ...@@ -756,7 +756,7 @@ class TestSecureHTTPServer(unittest.TestCase):
orig_check_func = self.server._check_key_and_cert orig_check_func = self.server._check_key_and_cert
try: try:
self.server._check_key_and_cert = lambda x,y: None self.server._check_key_and_cert = lambda x,y: None
self.assertRaises(socket.error, self.assertRaises(IOError,
self.server._wrap_socket_in_ssl_context, self.server._wrap_socket_in_ssl_context,
sock, sock,
'no_such_file', 'no_such_file') 'no_such_file', 'no_such_file')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment