Как правильно реализовать следующий код для версии uasyncio V3? обнаружение исключений не работает в приведенном ниже коде.
async def main():
tasks = (s1, s2)
try:
res = await uasyncio.funcs.gather(*tasks, return_exceptions=True)
except uasyncio.CancelledError:
print("Cancelled.")
except Exception as e:
print("error")
try:
uasyncio.run(main())
except KeyboardInterrupt as e: # its work ok.
print("Caught keyboard interrupt. Canceling tasks...")
uasyncio.new_event_loop()
except Exception as e: # not working ?
print("error: "+str(e))