From 16e2751421802b9a6edb09700acb8cb089a79589 Mon Sep 17 00:00:00 2001 From: Jean Raby Date: Tue, 2 Aug 2016 16:14:57 -0400 Subject: [PATCH] py2 compat: Do not catch py3 only exception Connection*Error and PermissionError are subclasses of OSError so no need to be overly specific. --- haproxyadmin/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/haproxyadmin/utils.py b/haproxyadmin/utils.py index c668be0..f1b8571 100644 --- a/haproxyadmin/utils.py +++ b/haproxyadmin/utils.py @@ -176,13 +176,12 @@ def connected_socket(path): unix_socket.connect(path) unix_socket.send(six.b('show info' + '\n')) file_handle = unix_socket.makefile() - except (ConnectionRefusedError, PermissionError, socket.timeout, OSError): + except (socket.timeout, OSError): return False else: try: data = file_handle.read().splitlines() - except (ConnectionResetError, ConnectionRefusedError, PermissionError, - socket.timeout, OSError): + except (socket.timeout, OSError): return False else: hap_info = info2dict(data)