From 502464d629d4e525e0ba68e8dbdf5632b3808596 Mon Sep 17 00:00:00 2001 From: Cory Johns Date: Wed, 8 Mar 2017 08:39:56 -0600 Subject: [PATCH] Don't raise ConnectionClosed error in receiver task --- juju/client/connection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/juju/client/connection.py b/juju/client/connection.py index b9eb3bc..3ee8f16 100644 --- a/juju/client/connection.py +++ b/juju/client/connection.py @@ -97,9 +97,11 @@ class Connection: await self.messages.put(result['request-id'], result) except Exception as e: await self.messages.put_all(e) + if isinstance(e, websockets.ConnectionClosed): + # ConnectionClosed is not really exceptional for us, + # but it may be for any pending message listeners + return raise - await self.messages.put_all(websockets.exceptions.ConnectionClosed( - 0, 'websocket closed')) async def rpc(self, msg, encoder=None): self.__request_id__ += 1 -- 2.25.1