MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / _handle_response

Method _handle_response

unity_cli/client.py:367–381  ·  view source on GitHub ↗

Handle RESPONSE or ERROR message from relay server.

(self, response: dict[str, Any], command: str)

Source from the content-addressed store, hash-verified

365 )
366
367 def _handle_response(self, response: dict[str, Any], command: str) -> dict[str, Any]:
368 """Handle RESPONSE or ERROR message from relay server."""
369 msg_type = response.get("type")
370
371 if msg_type == "ERROR":
372 self._raise_error(response)
373
374 if msg_type == "RESPONSE":
375 return self._handle_success_response(response, command)
376
377 if msg_type == "INSTANCES":
378 data: dict[str, Any] = response.get("data", {})
379 return data
380
381 raise ProtocolError(f"Unexpected response type: {msg_type}", "PROTOCOL_ERROR")
382
383 def _raise_error(self, response: dict[str, Any]) -> None:
384 """Raise appropriate exception from ERROR response."""

Calls 4

_raise_errorMethod · 0.95
ProtocolErrorClass · 0.90
getMethod · 0.45