Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions asynch/proto/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from urllib.parse import urlparse

from asynch.errors import (
OperationalError,
PartiallyConsumedQueryError,
ServerException,
UnexpectedPacketFromServerError,
Expand Down Expand Up @@ -320,10 +321,12 @@ async def ping(self) -> bool:
msg = self.unexpected_packet_message("Pong", packet_type)
raise UnexpectedPacketFromServerError(msg)
return True
except AttributeError:
logger.debug("The connection %s is not open", self)
except OperationalError as e:
logger.info("The connection %s is not open", self, exc_info=e)
except AttributeError as e:
logger.info("The connection %s is not open", self, exc_info=e)
except IndexError as e:
logger.debug(
logger.info(
"Ping package smaller than expected or empty. "
"There may be connection or network problems - "
"we believe that the connection is incorrect.",
Expand All @@ -334,7 +337,7 @@ async def ping(self) -> bool:
# because this is a connection loss case
if isinstance(e, RuntimeError) and "TCPTransport closed=True" not in str(e):
raise e
logger.debug("Socket closed", exc_info=e)
logger.info("Socket closed", exc_info=e)
return False

async def receive_data(self, raw=False):
Expand Down