Skip to content

Commit fbd72ca

Browse files
committed
cli: gracefully handle ConnectionFailedError
1 parent 4cc3ab4 commit fbd72ca

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pymobiledevice3/__main__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414
from pymobiledevice3.cli.cli_common import TUNNEL_ENV_VAR, isatty
1515
from pymobiledevice3.exceptions import AccessDeniedError, CloudConfigurationAlreadyPresentError, \
16-
ConnectionFailedToUsbmuxdError, DeprecationError, DeveloperModeError, DeveloperModeIsNotEnabledError, \
17-
DeviceHasPasscodeSetError, DeviceNotFoundError, FeatureNotSupportedError, InternalError, InvalidServiceError, \
18-
MessageNotSupportedError, MissingValueError, NoDeviceConnectedError, NotEnoughDiskSpaceError, NotPairedError, \
19-
OSNotSupportedError, PairingDialogResponsePendingError, PasswordRequiredError, QuicProtocolNotSupportedError, \
20-
RSDRequiredError, SetProhibitedError, TunneldConnectionError, UserDeniedPairingError
16+
ConnectionFailedError, ConnectionFailedToUsbmuxdError, DeprecationError, DeveloperModeError, \
17+
DeveloperModeIsNotEnabledError, DeviceHasPasscodeSetError, DeviceNotFoundError, FeatureNotSupportedError, \
18+
InternalError, InvalidServiceError, MessageNotSupportedError, MissingValueError, NoDeviceConnectedError, \
19+
NotEnoughDiskSpaceError, NotPairedError, OSNotSupportedError, PairingDialogResponsePendingError, \
20+
PasswordRequiredError, QuicProtocolNotSupportedError, RSDRequiredError, SetProhibitedError, \
21+
TunneldConnectionError, UserDeniedPairingError
2122
from pymobiledevice3.lockdown import retry_create_using_usbmux
2223
from pymobiledevice3.osu.os_utils import get_os_utils
2324

@@ -208,6 +209,9 @@ def invoke_cli_with_error_handling() -> bool:
208209
logger.error(f'Failed to enable developer-mode. Error: {e}')
209210
except ConnectionFailedToUsbmuxdError:
210211
logger.error('Failed to connect to usbmuxd socket. Make sure it\'s running.')
212+
except ConnectionFailedError:
213+
logger.error('Failed to connect to service port.')
214+
return True
211215
except MessageNotSupportedError:
212216
logger.error('Message not supported for this iOS version')
213217
traceback.print_exc()

0 commit comments

Comments
 (0)