INNER CODE UNIT · Python

validation_exception_handler

cqzyys/lang-agent · lang-agent-backend/lang_agent/main.py:50

    async def validation_exception_handler(
        request: Request, exc: RequestValidationError
    ):
        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(ValidationError)
    async def pydantic_validation_exception_handler(
        request: Request, exc: ValidationError
    ):
        logger.error(exc.errors())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…