Except IOError and not ConnectionError

PySocks' errors do not subclass ConnectionError so the library
was unnecessarily logging them as unexpected, when any IOError
was actually expected.
This commit is contained in:
Lonami Exo
2019-03-28 09:52:46 +01:00
parent c902428af1
commit 7523869875
3 changed files with 10 additions and 7 deletions

View File

@@ -144,7 +144,7 @@ class Connection(abc.ABC):
except asyncio.CancelledError:
pass
except Exception as e:
if isinstance(e, ConnectionError):
if isinstance(e, IOError):
self._log.info('The server closed the connection while sending')
else:
self._log.exception('Unexpected exception in the send loop')
@@ -161,7 +161,7 @@ class Connection(abc.ABC):
except asyncio.CancelledError:
break
except Exception as e:
if isinstance(e, (ConnectionError, asyncio.IncompleteReadError)):
if isinstance(e, (IOError, asyncio.IncompleteReadError)):
msg = 'The server closed the connection'
self._log.info(msg)
elif isinstance(e, InvalidChecksumError):