Handle the right errors

This commit is contained in:
Lonami Exo
2018-10-19 14:41:50 +02:00
parent b93b01cb02
commit 9dc4009152
3 changed files with 41 additions and 30 deletions

View File

@@ -4,6 +4,8 @@ import logging
import socket
import ssl as ssl_mod
from ...errors import InvalidChecksumError
__log__ = logging.getLogger(__name__)
@@ -173,6 +175,9 @@ class Connection(abc.ABC):
if isinstance(e, asyncio.IncompleteReadError):
msg = 'The server closed the connection'
logging.info(msg)
elif isinstance(e, InvalidChecksumError):
msg = 'The server response had an invalid checksum'
logging.info(msg)
else:
msg = 'Unexpected exception in the receive loop'
logging.exception(msg)