fix: add error handling to api_call for better debugging
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 20s

This commit is contained in:
2026-05-05 02:38:08 +00:00
parent b10de36c17
commit 77656c9925

View File

@@ -266,8 +266,12 @@ async def api_call(method: str, params: str = "{}") -> str:
parsed_params = json.loads(params) if params else {} parsed_params = json.loads(params) if params else {}
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
return serialize_json({"error": f"Invalid JSON in params: {e}"}) return serialize_json({"error": f"Invalid JSON in params: {e}"})
try:
result = await method_func(**parsed_params) result = await method_func(**parsed_params)
return serialize_json(result) return serialize_json(result)
except Exception as e:
logger.error(f"api_call failed for method={method}: {e}")
return serialize_json({"error": str(e), "method": method})
# --- Health Check Endpoint --- # --- Health Check Endpoint ---