@@ -42,7 +42,7 @@ from .storage import (WalletStorage, STO_EV_USER_PW, STO_EV_XPUB_PW,
|
|||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .util import UserCancelled, InvalidPassword, WalletFileException
|
from .util import UserCancelled, InvalidPassword, WalletFileException
|
||||||
from .simple_config import SimpleConfig
|
from .simple_config import SimpleConfig
|
||||||
from .plugin import Plugins
|
from .plugin import Plugins, HardwarePluginLibraryUnavailable
|
||||||
from .logging import Logger
|
from .logging import Logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -255,7 +255,8 @@ class BaseWizard(Logger):
|
|||||||
|
|
||||||
def failed_getting_device_infos(name, e):
|
def failed_getting_device_infos(name, e):
|
||||||
nonlocal debug_msg
|
nonlocal debug_msg
|
||||||
self.logger.info(f'error getting device infos for {name}: {e}')
|
err_str_oneline = ' // '.join(str(e).splitlines())
|
||||||
|
self.logger.warning(f'error getting device infos for {name}: {err_str_oneline}')
|
||||||
indented_error_msg = ' '.join([''] + str(e).splitlines(keepends=True))
|
indented_error_msg = ' '.join([''] + str(e).splitlines(keepends=True))
|
||||||
debug_msg += f' {name}: (error getting device infos)\n{indented_error_msg}\n'
|
debug_msg += f' {name}: (error getting device infos)\n{indented_error_msg}\n'
|
||||||
|
|
||||||
@@ -281,6 +282,9 @@ class BaseWizard(Logger):
|
|||||||
# FIXME: side-effect: unpaired_device_info sets client.handler
|
# FIXME: side-effect: unpaired_device_info sets client.handler
|
||||||
device_infos = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices,
|
device_infos = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices,
|
||||||
include_failing_clients=True)
|
include_failing_clients=True)
|
||||||
|
except HardwarePluginLibraryUnavailable as e:
|
||||||
|
failed_getting_device_infos(name, e)
|
||||||
|
continue
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
failed_getting_device_infos(name, e)
|
failed_getting_device_infos(name, e)
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ class BasePlugin(Logger):
|
|||||||
|
|
||||||
class DeviceNotFoundError(Exception): pass
|
class DeviceNotFoundError(Exception): pass
|
||||||
class DeviceUnpairableError(Exception): pass
|
class DeviceUnpairableError(Exception): pass
|
||||||
|
class HardwarePluginLibraryUnavailable(Exception): pass
|
||||||
|
|
||||||
|
|
||||||
class Device(NamedTuple):
|
class Device(NamedTuple):
|
||||||
@@ -502,7 +503,7 @@ class DeviceMgr(ThreadJob):
|
|||||||
unpaired device accepted by the plugin.'''
|
unpaired device accepted by the plugin.'''
|
||||||
if not plugin.libraries_available:
|
if not plugin.libraries_available:
|
||||||
message = plugin.get_library_not_available_message()
|
message = plugin.get_library_not_available_message()
|
||||||
raise Exception(message)
|
raise HardwarePluginLibraryUnavailable(message)
|
||||||
if devices is None:
|
if devices is None:
|
||||||
devices = self.scan_devices()
|
devices = self.scan_devices()
|
||||||
devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)]
|
devices = [dev for dev in devices if not self.xpub_by_id(dev.id_)]
|
||||||
|
|||||||
Reference in New Issue
Block a user