error list filds

This commit is contained in:
larssand
2026-06-22 22:28:07 +02:00
parent a55325610c
commit 8f102b3fb9

View File

@@ -274,6 +274,10 @@ def serve_dashboard(host: str, port: int, status_file: str, *, image_dir: str |
result = client.call_tool("list_streams", {})
content = result.get("result", {}).get("content", [])
text = next((item.get("text", "") for item in content if isinstance(item, dict)), "")
if isinstance(result.get("result"), dict) and result["result"].get("isError"):
raise RuntimeError(str(text or "Graylog list_streams failed"))
if not text:
raise RuntimeError("Graylog list_streams returned no text content")
streams = json.loads(text)
body = {"streams": streams, "selected": config.get("graylog_streams", [])}
self._send(200, "application/json", json.dumps(body).encode("utf-8"))