introduce UserFacingException
we should not raise generic Exception when wanting to communicate with the user. it makes distinguishing programming errors and messages hard, as the caller will necessarily need to catch all Exceptions then
This commit is contained in:
@@ -32,7 +32,7 @@ from typing import NamedTuple, Any, Union, TYPE_CHECKING, Optional
|
||||
|
||||
from .i18n import _
|
||||
from .util import (profiler, PrintError, DaemonThread, UserCancelled,
|
||||
ThreadJob, print_error)
|
||||
ThreadJob, print_error, UserFacingException)
|
||||
from . import bip32
|
||||
from . import plugins
|
||||
from .simple_config import SimpleConfig
|
||||
@@ -500,6 +500,8 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||
continue
|
||||
try:
|
||||
client = self.create_client(device, handler, plugin)
|
||||
except UserFacingException:
|
||||
raise
|
||||
except BaseException as e:
|
||||
self.print_error(f'failed to create client for {plugin.name} at {device.path}: {repr(e)}')
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user