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
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 20s
This commit is contained in:
@@ -266,8 +266,12 @@ async def api_call(method: str, params: str = "{}") -> str:
|
||||
parsed_params = json.loads(params) if params else {}
|
||||
except json.JSONDecodeError as e:
|
||||
return serialize_json({"error": f"Invalid JSON in params: {e}"})
|
||||
result = await method_func(**parsed_params)
|
||||
return serialize_json(result)
|
||||
try:
|
||||
result = await method_func(**parsed_params)
|
||||
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 ---
|
||||
|
||||
Reference in New Issue
Block a user