1
0

wizard,hw: tell user about errors during plugin init

see #4817 (issuecomment-434765570)
This commit is contained in:
SomberNight
2018-10-31 17:58:47 +01:00
parent 4f7283a3b0
commit 386e0d560e
3 changed files with 42 additions and 20 deletions

View File

@@ -28,7 +28,7 @@ import os
import pkgutil
import time
import threading
from typing import NamedTuple, Any, Union
from typing import NamedTuple, Any, Union, TYPE_CHECKING, Optional
from .i18n import _
from .util import (profiler, PrintError, DaemonThread, UserCancelled,
@@ -37,6 +37,9 @@ from . import bip32
from . import plugins
from .simple_config import SimpleConfig
if TYPE_CHECKING:
from .plugins.hw_wallet import HW_PluginBase
plugin_loaders = {}
hook_names = set()
@@ -148,10 +151,17 @@ class Plugins(DaemonThread):
try:
p = self.get_plugin(name)
if p.is_enabled():
out.append([name, details[2], p])
except:
out.append(HardwarePluginToScan(name=name,
description=details[2],
plugin=p,
exception=None))
except Exception as e:
traceback.print_exc()
self.print_error("cannot load plugin for:", name)
out.append(HardwarePluginToScan(name=name,
description=details[2],
plugin=None,
exception=e))
return out
def register_wallet_type(self, name, gui_good, wallet_type):
@@ -277,6 +287,13 @@ class DeviceInfo(NamedTuple):
initialized: bool
class HardwarePluginToScan(NamedTuple):
name: str
description: str
plugin: Optional['HW_PluginBase']
exception: Optional[Exception]
class DeviceMgr(ThreadJob, PrintError):
'''Manages hardware clients. A client communicates over a hardware
channel with the device.