First Check
Commit to Help
Example Code
import asyncer
import logging
from typing import Union
from fastapi import FastAPI
async def func1(name: str):
return {"message": f"Hello {name} form func1"}
async def func2():
return {"message": f"Hello {name} form func2"}
@app.get("/test")
async def knowledge_panel(name_str: str):
async with asyncer.create_task_group() as task_group:
try:
soon_value1 = task_group.soonify(func1)(name=name_str)
except Exception:
logging.exception()
try:
soon_value2 = task_group.soonify(func2)(name=name_str)
except Exception:
logging.exception()
data = [soon_value1.value, soon_value2.value]
return data
Description
- How to handle an exception like here soon_value2 will throw an error, then how could I catch the exceptions and return user only single data rather than crashing the whole program?
Operating System
Windows
Operating System Details
No response
asyncer Version
0.0.1
Python Version
Python 3.10.5
Additional Context
No response
First Check
Commit to Help
Example Code
Description
Operating System
Windows
Operating System Details
No response
asyncer Version
0.0.1
Python Version
Python 3.10.5
Additional Context
No response