qt: wizard: differentiate between create_storage exc types
What changed, and why it matters
This commit changes how Electrum's Qt wallet handles errors when creating or loading a wallet file. Previously, some internal errors were shown to the user as generic warnings and not sent to developers. Now, unexpected errors are forwarded to the crash reporter so bugs can be fixed. It is a defensive improvement, not a fix for a known exploitable vulnerability.
Treat as a routine defensive-quality improvement. No urgent action required. Review whether crash reporter submissions contain sensitive wallet data and ensure privacy controls are in place.
Security signals we found
Improved error handling and crash reporting for wallet load failures
UserFacingException now separated from internal/unexpected exceptions
Unexpected exceptions forwarded to crash reporter rather than silently shown as warnings
Evidence from the diff
The patch refines exception handling in electrum/gui/qt/init.py during wallet creation/storage. It distinguishes UserFacingException (user-friendly messages) from WalletFileException and other exceptions. Unexpected/non-user-facing exceptions are now sent to send_exception_to_crash_reporter instead of being swallowed or only shown in a warning dialog. This improves diagnostics but does not by itself prevent an attack.
Changed components
electrum/gui/qt/__init__.pyQt GUI wallet startup/load pathInspect captured patch +10 / −7
diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
index 4a37fb1..e6fef17 100644
--- a/electrum/gui/qt/__init__.py
+++ b/electrum/gui/qt/__init__.py
@@ -70,7 +70,7 @@ from electrum.i18n import _, set_language
from electrum.plugin import run_hook
from electrum.util import (UserCancelled, profiler, send_exception_to_crash_reporter,
WalletFileException, get_new_wallet_name, InvalidPassword,
- standardize_path)
+ standardize_path, UserFacingException)
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.wallet_db import WalletRequiresSplit, WalletRequiresUpgrade, WalletUnfinished
from electrum.gui import BaseElectrumGui
@@ -411,12 +411,15 @@ class ElectrumGui(BaseElectrumGui, Logger):
return
except Exception as e:
self.logger.exception('')
- err_text = str(e) if isinstance(e, WalletFileException) else repr(e)
- custom_message_box(icon=QMessageBox.Icon.Warning,
- parent=None,
- title=_('Error'),
- text=_('Cannot load wallet') + '(2) :\n' + err_text)
- if isinstance(e, WalletFileException) and e.should_report_crash:
+ if isinstance(e, UserFacingException) \
+ or isinstance(e, WalletFileException) and not e.should_report_crash:
+ err_text = str(e) if isinstance(e, WalletFileException) else repr(e)
+ custom_message_box(icon=QMessageBox.Icon.Warning,
+ parent=None,
+ title=_('Error'),
+ text=_('Cannot load wallet') + '(2) :\n' + err_text)
+ elif isinstance(e, WalletFileException) and e.should_report_crash \
+ or not isinstance(e, WalletFileException):
send_exception_to_crash_reporter(e)
if app_is_starting:
# If we raise in this context, there are no more fallbacks, we will shut down.
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.