INNER CODE UNIT · Python
lifespan
cqzyys/lang-agent · lang-agent-backend/lang_agent/main.py:38
async def lifespan(app: FastAPI):
os.makedirs(Path("lang_agent/tmp"), exist_ok=True)
logger.debug("setup_database_connection start......")
setup_database_connection()
logger.debug("setup_database_connection end")
await resource_init()
yield
await async_checkpointer_shutdown()
def register_exception_handlers(app: FastAPI):
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(
request: Request, exc: RequestValidationError
):
logger.error(exc.errors())
return JSONResponse(
status_code=422,