From 2c015b1c9d56815ff5602538320b72c955c5924f Mon Sep 17 00:00:00 2001 From: Naveen Michaud-Agrawal Date: Sun, 20 Sep 2020 23:08:48 -0400 Subject: [PATCH] Catch ClosedResourceError. Fixes #134 --- trio_websocket/_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio_websocket/_impl.py b/trio_websocket/_impl.py index 53b5ae4..bd63b3c 100644 --- a/trio_websocket/_impl.py +++ b/trio_websocket/_impl.py @@ -1069,7 +1069,7 @@ async def _handle_message_event(self, event): self._message_parts = [] try: await self._send_channel.send(msg) - except trio.BrokenResourceError: + except (trio.ClosedResourceError, trio.BrokenResourceError): # The receive channel is closed, probably because somebody # called ``aclose()``. We don't want to abort the reader task, # and there's no useful cleanup that we can do here.