Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Avoid ignoring asyncio exceptions in coroutines" #672

Merged
merged 2 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions juju/jasyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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))
Expand Down