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

Function exit_code_for

unity_cli/cli/exit_codes.py:28–40  ·  view source on GitHub ↗

Map a UnityCLIError to the appropriate exit code.

(exc: UnityCLIError)

Source from the content-addressed store, hash-verified

26
27
28def exit_code_for(exc: UnityCLIError) -> ExitCode:
29 """Map a UnityCLIError to the appropriate exit code."""
30 from unity_cli.exceptions import ConnectionError, InstanceError, TimeoutError
31
32 if isinstance(exc, ConnectionError):
33 return ExitCode.CONNECTION_ERROR
34 if isinstance(exc, TimeoutError):
35 return ExitCode.TRANSIENT_ERROR
36 if isinstance(exc, InstanceError):
37 if exc.code in _TRANSIENT_CODES:
38 return ExitCode.TRANSIENT_ERROR
39 return ExitCode.OPERATION_ERROR
40 return ExitCode.OPERATION_ERROR

Callers 2

test_exit_code_forFunction · 0.90
_handle_errorFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_exit_code_forFunction · 0.72