diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py index 4a25b72e..746dbf06 100644 --- a/pyrogram/connection/connection.py +++ b/pyrogram/connection/connection.py @@ -64,7 +64,10 @@ class Connection: log.info("Disconnected") async def send(self, data: bytes): - await self.protocol.send(data) + try: + await self.protocol.send(data) + except Exception: + raise OSError async def recv(self) -> bytes or None: return await self.protocol.recv()