INNER CODE UNIT · Python
pydantic_validation_exception_handler
cqzyys/lang-agent · lang-agent-backend/lang_agent/main.py:64
async def pydantic_validation_exception_handler(
request: Request, exc: ValidationError
):
logger.error(exc.errors())
return JSONResponse(
status_code=422,
content=ApiResponse(
success=False,
error=error_to_str(exc),
status_code=422,
).model_dump(),
)
@app.exception_handler(ValueError)
async def value_validation_exception_handler(request: Request, exc: ValueError):
logger.error(exc)
return JSONResponse(
status_code=422,