INNER CODE UNIT · Python

database_error_handler

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

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

    @app.exception_handler(Exception)
    async def general_exception_handler(request: Request, exc: Exception):
        logger.error(exc)
        return JSONResponse(
            status_code=404,
            content=ApiResponse(
                success=False,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…