1
0

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:
SomberNight
2018-11-08 19:46:15 +01:00
parent dace2e5495
commit bd32b88f62
10 changed files with 70 additions and 59 deletions

View File

@@ -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