Map a UnityCLIError to the appropriate exit code.
(exc: UnityCLIError)
| 26 | |
| 27 | |
| 28 | def 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 |
no outgoing calls