From 97fc6d653c1a978c98f27483bfb75eeb155fa2ac Mon Sep 17 00:00:00 2001 From: "Anthr@X" <4828355+AnthraX1@users.noreply.github.com> Date: Mon, 2 Aug 2021 18:34:15 +1000 Subject: [PATCH] Change error type to match native socket error Change error from ValueError to socket.error to match original socket error behavior and increase compatiablity with other libraries such as pymongo. --- socks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socks.py b/socks.py index 83b1435..12b2537 100644 --- a/socks.py +++ b/socks.py @@ -253,7 +253,7 @@ def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, *args, **kwargs): if type not in (socket.SOCK_STREAM, socket.SOCK_DGRAM): msg = "Socket type must be stream or datagram, not {!r}" - raise ValueError(msg.format(type)) + raise socket.error(msg.format(type)) super(socksocket, self).__init__(family, type, proto, *args, **kwargs) self._proxyconn = None # TCP connection to keep UDP relay alive