From 5d58ff2d941686e8da845b520e805783f572b867 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 17 Jun 2018 18:45:08 +0200 Subject: [PATCH] Raise OSError in case "send" fails --- pyrogram/connection/connection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()