diff options
-rw-r--r-- | cloud_mdir_sync/util.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cloud_mdir_sync/util.py b/cloud_mdir_sync/util.py index 836bf56..a35e5e4 100644 --- a/cloud_mdir_sync/util.py +++ b/cloud_mdir_sync/util.py @@ -75,9 +75,8 @@ async def asyncio_complete(*awo_list): """This is like asyncio.gather but it always ensures that the list of awaitable objects is completed upon return. For instance if an exception is thrown then all the awaitables are canceled""" - g = asyncio.gather(*awo_list) - try: - return await g - finally: - g.cancel() - await asyncio.gather(*awo_list, return_exceptions=True) + res = await asyncio.gather(*awo_list, return_exceptions=True) + for I in res: + if isinstance(I, Exception): + raise I + return res |