Skip to content

Commit

Permalink
Merge pull request #1338 from doronz88/bugfix/connection-failed-error
Browse files Browse the repository at this point in the history
cli: gracefully handle `ConnectionFailedError`
  • Loading branch information
doronz88 authored Jan 15, 2025
2 parents 4cc3ab4 + fbd72ca commit 1c6445a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pymobiledevice3/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

from pymobiledevice3.cli.cli_common import TUNNEL_ENV_VAR, isatty
from pymobiledevice3.exceptions import AccessDeniedError, CloudConfigurationAlreadyPresentError, \
ConnectionFailedToUsbmuxdError, DeprecationError, DeveloperModeError, DeveloperModeIsNotEnabledError, \
DeviceHasPasscodeSetError, DeviceNotFoundError, FeatureNotSupportedError, InternalError, InvalidServiceError, \
MessageNotSupportedError, MissingValueError, NoDeviceConnectedError, NotEnoughDiskSpaceError, NotPairedError, \
OSNotSupportedError, PairingDialogResponsePendingError, PasswordRequiredError, QuicProtocolNotSupportedError, \
RSDRequiredError, SetProhibitedError, TunneldConnectionError, UserDeniedPairingError
ConnectionFailedError, ConnectionFailedToUsbmuxdError, DeprecationError, DeveloperModeError, \
DeveloperModeIsNotEnabledError, DeviceHasPasscodeSetError, DeviceNotFoundError, FeatureNotSupportedError, \
InternalError, InvalidServiceError, MessageNotSupportedError, MissingValueError, NoDeviceConnectedError, \
NotEnoughDiskSpaceError, NotPairedError, OSNotSupportedError, PairingDialogResponsePendingError, \
PasswordRequiredError, QuicProtocolNotSupportedError, RSDRequiredError, SetProhibitedError, \
TunneldConnectionError, UserDeniedPairingError
from pymobiledevice3.lockdown import retry_create_using_usbmux
from pymobiledevice3.osu.os_utils import get_os_utils

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

0 comments on commit 1c6445a

Please sign in to comment.