How to cancel all remaining tasks in gather if one fails?
问题 In case one task of gather raises an exception, the others are still allowed to continue. Well, that's not exactly what I need. I want to distinguish between errors that are fatal and need to cancel all remaining tasks, and errors that are not and instead should be logged while allowing other tasks to continue. Here is my failed attempt to implement this: from asyncio import gather, get_event_loop, sleep class ErrorThatShouldCancelOtherTasks(Exception): pass async def my_sleep(secs): await