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