INNER CODE UNIT · Python

http_exception_handler

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

    async def http_exception_handler(request: Request, exc: HTTPException):
        logger.error(exc.detail)
        return JSONResponse(
            status_code=exc.status_code,
            content=ApiResponse(
                success=False,
                error=error_to_str(exc),
                status_code=exc.status_code,
            ).model_dump(),
        )

    @app.exception_handler(IntegrityError)
    async def integrity_error_handler(request: Request, exc: IntegrityError):
        logger.error(exc.detail)
        return JSONResponse(
            status_code=409,
            content=ApiResponse(
                success=False,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…