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

Method _raise_error

unity_cli/client.py:383–393  ·  view source on GitHub ↗

Raise appropriate exception from ERROR response.

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

Source from the content-addressed store, hash-verified

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."""
385 error = response.get("error", {})
386 code = error.get("code", "UNKNOWN_ERROR")
387 message = error.get("message", "Unknown error")
388
389 if code in self._INSTANCE_ERROR_CODES:
390 raise InstanceError(message, code)
391 if code == "TIMEOUT":
392 raise TimeoutError(message, code)
393 raise UnityCLIError(message, code)
394
395 def _handle_success_response(self, response: dict[str, Any], command: str) -> dict[str, Any]:
396 """Handle successful RESPONSE message."""

Callers 1

_handle_responseMethod · 0.95

Calls 4

InstanceErrorClass · 0.90
TimeoutErrorClass · 0.90
UnityCLIErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected