(request: Request, exc: AegisFlowError)
| 82 | |
| 83 | @app.exception_handler(GlmDeskError) |
| 84 | async def handle_glm_desk_error(request: Request, exc: GlmDeskError) -> JSONResponse: |
| 85 | logger.warning("application error on %s: %s", request.url.path, exc.message) |
| 86 | account_id = str(request.path_params.get("account_id") or "").strip() |
| 87 | runtime_logs = get_runtime_log_service() |
| 88 | if account_id: |
| 89 | runtime_logs.log_account_event( |
| 90 | account_id=account_id, |
| 91 | action="request", |
| 92 | stage="http_error", |
| 93 | status="failed", |
| 94 | message=exc.message, |
| 95 | details={"path": request.url.path, "code": exc.code, "details": exc.details}, |
| 96 | level=logging.WARNING, |
| 97 | ) |
| 98 | else: |
| 99 | runtime_logs.log_system_event( |
| 100 | stage="http_error", |
| 101 | status="failed", |
| 102 | message=exc.message, |
| 103 | details={"path": request.url.path, "code": exc.code, "details": exc.details}, |
| 104 | level=logging.WARNING, |
| 105 | ) |
| 106 | return JSONResponse(status_code=exc.status_code, content=exc.to_payload()) |
| 107 | |
| 108 | @app.exception_handler(Exception) |
| 109 | async def handle_unexpected_error(request: Request, exc: Exception) -> JSONResponse: |
nothing calls this directly
no test coverage detected