diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 1a43a7df3..ba5b00871 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -379,6 +379,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): elif isinstance(e, UserFacingException): self.show_error(str(e)) else: + # TODO would be nice if we just sent these to the crash reporter... + # anything we don't want to send there, we should explicitly catch + # send_exception_to_crash_reporter(e) try: self.logger.error("on_error", exc_info=exc_info) except OSError: diff --git a/electrum/plugins/hw_wallet/qt.py b/electrum/plugins/hw_wallet/qt.py index 3291d3bd9..8df94ad7c 100644 --- a/electrum/plugins/hw_wallet/qt.py +++ b/electrum/plugins/hw_wallet/qt.py @@ -39,7 +39,7 @@ from electrum.gui.qt.installwizard import InstallWizard from electrum.i18n import _ from electrum.logging import Logger -from electrum.util import parse_URI, InvalidBitcoinURI, UserCancelled +from electrum.util import parse_URI, InvalidBitcoinURI, UserCancelled, UserFacingException from electrum.plugin import hook, DeviceUnpairableError from .plugin import OutdatedHwFirmwareException, HW_PluginBase, HardwareHandlerBase @@ -213,7 +213,7 @@ class QtPluginBase(object): window.show_error(message) return tooltip = self.device + '\n' + (keystore.label or 'unnamed') - cb = partial(self.show_settings_dialog, window, keystore) + cb = partial(self._on_status_bar_button_click, window=window, keystore=keystore) button = StatusBarButton(read_QIcon(self.icon_unpaired), tooltip, cb) button.icon_paired = self.icon_paired button.icon_unpaired = self.icon_unpaired @@ -226,6 +226,13 @@ class QtPluginBase(object): # Trigger a pairing keystore.thread.add(partial(self.get_client, keystore)) + def _on_status_bar_button_click(self, *, window: ElectrumWindow, keystore: 'Hardware_KeyStore'): + try: + self.show_settings_dialog(window=window, keystore=keystore) + except (UserFacingException, UserCancelled) as e: + exc_info = (type(e), e, e.__traceback__) + self.on_task_thread_error(window=window, keystore=keystore, exc_info=exc_info) + def on_task_thread_error(self: Union['QtPluginBase', HW_PluginBase], window: ElectrumWindow, keystore: 'Hardware_KeyStore', exc_info): e = exc_info[1]