quick fix
This commit is contained in:
@@ -17,7 +17,11 @@ from aegis_gitea_mcp.audit import get_audit_logger
|
||||
from aegis_gitea_mcp.auth import get_validator
|
||||
from aegis_gitea_mcp.automation import AutomationError, AutomationManager
|
||||
from aegis_gitea_mcp.config import get_settings
|
||||
from aegis_gitea_mcp.gitea_client import GiteaClient
|
||||
from aegis_gitea_mcp.gitea_client import (
|
||||
GiteaAuthenticationError,
|
||||
GiteaAuthorizationError,
|
||||
GiteaClient,
|
||||
)
|
||||
from aegis_gitea_mcp.logging_utils import configure_logging
|
||||
from aegis_gitea_mcp.mcp_protocol import (
|
||||
AVAILABLE_TOOLS,
|
||||
@@ -240,9 +244,19 @@ async def startup_event() -> None:
|
||||
async with GiteaClient() as gitea:
|
||||
user = await gitea.get_current_user()
|
||||
logger.info("gitea_connected", extra={"bot_user": user.get("login", "unknown")})
|
||||
except Exception:
|
||||
except GiteaAuthenticationError as exc:
|
||||
logger.error("gitea_connection_failed_authentication")
|
||||
raise RuntimeError(
|
||||
"Startup validation failed: Gitea authentication was rejected. Check GITEA_TOKEN."
|
||||
) from exc
|
||||
except GiteaAuthorizationError as exc:
|
||||
logger.error("gitea_connection_failed_authorization")
|
||||
raise RuntimeError(
|
||||
"Startup validation failed: Gitea token lacks permission for /api/v1/user."
|
||||
) from exc
|
||||
except Exception as exc:
|
||||
logger.error("gitea_connection_failed")
|
||||
raise
|
||||
raise RuntimeError("Startup validation failed: unable to connect to Gitea.") from exc
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
|
||||
Reference in New Issue
Block a user