crash reporter: if disabled via config, make sure EEQueue is flushed
If the user had `config.get("show_crash_reporter")==False`, they would
never get to see excs collected via `send_exception_to_crash_reporter(exc)`.
E.g.:
```
E | gui.qt.ElectrumGui | error loading wallet (or creating window for it)
Traceback (most recent call last):
File "/opt/electrum/electrum/gui/qt/__init__.py", line 433, in main
if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
File "/opt/electrum/electrum/gui/qt/__init__.py", line 307, in wrapper
return func(self, *args, **kwargs)
File "/opt/electrum/electrum/gui/qt/__init__.py", line 332, in start_new_window
wallet = self._start_wizard_to_select_or_create_wallet(path)
File "/opt/electrum/electrum/gui/qt/__init__.py", line 377, in _start_wizard_to_select_or_create_wallet
db = WalletDB(storage.read(), manual_upgrades=False)
File "/opt/electrum/electrum/wallet_db.py", line 73, in __init__
self.load_data(raw)
File "/opt/electrum/electrum/wallet_db.py", line 104, in load_data
self._after_upgrade_tasks()
File "/opt/electrum/electrum/wallet_db.py", line 202, in _after_upgrade_tasks
self._load_transactions()
File "/opt/electrum/electrum/util.py", line 439, in <lambda>
return lambda *args, **kw_args: do_profile(args, kw_args)
File "/opt/electrum/electrum/util.py", line 435, in do_profile
o = func(*args, **kw_args)
File "/opt/electrum/electrum/wallet_db.py", line 1310, in _load_transactions
self.data = StoredDict(self.data, self, [])
File "/opt/electrum/electrum/json_db.py", line 79, in __init__
self.__setitem__(k, v)
File "/opt/electrum/electrum/json_db.py", line 44, in wrapper
return func(self, *args, **kwargs)
File "/opt/electrum/electrum/json_db.py", line 97, in __setitem__
v = self.db._convert_dict(self.path, key, v)
File "/opt/electrum/electrum/wallet_db.py", line 1361, in _convert_dict
v = dict((k, SwapData(**x)) for k, x in v.items())
```
This commit is contained in:
@@ -146,6 +146,7 @@ class EarlyExceptionsQueue:
|
||||
|
||||
@classmethod
|
||||
def set_hook_as_ready(cls):
|
||||
"""Flush the queue and disable it for future exceptions."""
|
||||
if cls._is_exc_hook_ready:
|
||||
return
|
||||
cls._is_exc_hook_ready = True
|
||||
|
||||
@@ -180,6 +180,7 @@ class ExceptionHook(base.ExceptionHandler, Logger):
|
||||
Logger.__init__(self)
|
||||
self.main_window = main_window
|
||||
if not main_window.electrum_config.get(BaseCrashReporter.config_key, default=True):
|
||||
EarlyExceptionsQueue.set_hook_as_ready() # flush already queued exceptions
|
||||
return
|
||||
# For exceptions in Kivy:
|
||||
base.ExceptionManager.add_handler(self)
|
||||
|
||||
@@ -177,6 +177,7 @@ class Exception_Hook(QObject, Logger):
|
||||
@classmethod
|
||||
def maybe_setup(cls, *, config: 'SimpleConfig', wallet: 'Abstract_Wallet' = None) -> None:
|
||||
if not config.get(BaseCrashReporter.config_key, default=True):
|
||||
EarlyExceptionsQueue.set_hook_as_ready() # flush already queued exceptions
|
||||
return
|
||||
if not cls._INSTANCE:
|
||||
cls._INSTANCE = Exception_Hook(config=config)
|
||||
|
||||
Reference in New Issue
Block a user