Skip to content

Commit 70c7555

Browse files
committed
Revert "Avoid ignoring asyncio exceptions in coroutines"
This reverts commit f7552be.
1 parent 7d2a423 commit 70c7555

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

juju/client/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ async def _debug_logger(self):
512512
# be cancelled by the reconnect and we don't want the reconnect
513513
# to be aborted half-way through
514514
jasyncio.ensure_future(self.reconnect())
515-
raise
515+
return
516516
except Exception as e:
517517
log.exception("Error in debug logger : %s" % e)
518518
jasyncio.create_task(self.close())
@@ -539,7 +539,7 @@ async def _receiver(self):
539539
# be cancelled by the reconnect and we don't want the reconnect
540540
# to be aborted half-way through
541541
jasyncio.ensure_future(self.reconnect())
542-
raise
542+
return
543543
except Exception as e:
544544
log.exception("Error in receiver")
545545
# make pending listeners aware of the error
@@ -576,7 +576,7 @@ async def _do_ping():
576576
# The connection has closed - we can't do anything
577577
# more until the connection is restarted.
578578
log.debug('ping failed because of closed connection')
579-
raise
579+
pass
580580

581581
async def rpc(self, msg, encoder=None):
582582
'''Make an RPC to the API. The message is encoded as JSON

juju/jasyncio.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger):
6565
try:
6666
task.result()
6767
except CancelledError:
68-
raise
68+
pass
6969
except websockets.exceptions.ConnectionClosed:
70-
raise
70+
return
7171
except Exception as e:
7272
# This really is an arbitrary exception we need to catch
7373
#
@@ -76,7 +76,6 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger):
7676
# event_handler, which won't do anything but yell 'Task
7777
# exception was never retrieved' anyways.
7878
logger.exception("Task %s raised an exception: %s" % (task_name, e))
79-
raise
8079

8180
task = create_task(coro)
8281
task.add_done_callback(functools.partial(_task_result_exp_handler, task_name=task_name, logger=logger))

0 commit comments

Comments
 (0)