MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / handle_aegisflow_error

Function handle_aegisflow_error

app/errors.py:84–106  ·  view source on GitHub ↗
(request: Request, exc: AegisFlowError)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 4

get_runtime_log_serviceFunction · 0.90
log_account_eventMethod · 0.80
log_system_eventMethod · 0.80
to_payloadMethod · 0.45

Tested by

no test coverage detected