diff --git a/juju/client/connection.py b/juju/client/connection.py index c67f1a8c8..8bac1946c 100644 --- a/juju/client/connection.py +++ b/juju/client/connection.py @@ -512,7 +512,7 @@ async def _debug_logger(self): # be cancelled by the reconnect and we don't want the reconnect # to be aborted half-way through jasyncio.ensure_future(self.reconnect()) - raise + return except Exception as e: log.exception("Error in debug logger : %s" % e) jasyncio.create_task(self.close()) @@ -539,7 +539,7 @@ async def _receiver(self): # be cancelled by the reconnect and we don't want the reconnect # to be aborted half-way through jasyncio.ensure_future(self.reconnect()) - raise + return except Exception as e: log.exception("Error in receiver") # make pending listeners aware of the error @@ -576,7 +576,7 @@ async def _do_ping(): # The connection has closed - we can't do anything # more until the connection is restarted. log.debug('ping failed because of closed connection') - raise + pass async def rpc(self, msg, encoder=None): '''Make an RPC to the API. The message is encoded as JSON diff --git a/juju/jasyncio.py b/juju/jasyncio.py index 453639e0b..8cada79cc 100644 --- a/juju/jasyncio.py +++ b/juju/jasyncio.py @@ -65,9 +65,9 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger): try: task.result() except CancelledError: - raise + pass except websockets.exceptions.ConnectionClosed: - raise + return except Exception as e: # This really is an arbitrary exception we need to catch # @@ -76,7 +76,6 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger): # event_handler, which won't do anything but yell 'Task # exception was never retrieved' anyways. logger.exception("Task %s raised an exception: %s" % (task_name, e)) - raise task = create_task(coro) task.add_done_callback(functools.partial(_task_result_exp_handler, task_name=task_name, logger=logger))