Open this example in the interactive library
Source code
import asyncio
async def fail():
raise ValueError('demo')
async def main():
results = await asyncio.gather(fail(), return_exceptions=True)
return [type(item).__name__ for item in results]
print(asyncio.run(main()))Sample output
['ValueError']
