qt: ElectrumGui: repr(UserFacingException) -> str()
What changed, and why it matters
This commit is a minor user-interface cleanup in the Electrum Bitcoin wallet's Qt (desktop) GUI. It changes how an error message is displayed when a wallet fails to load. Previously, some errors were shown using repr(), which can include technical Python object details like class names and quotes; now all such errors are shown using str(), which typically gives a cleaner, more readable message. There is no direct security vulnerability here, but displaying repr() could leak minor implementation details or confuse users.
No security action required. Treat as a normal UI/UX improvement. If reviewing, confirm that str(UserFacingException) returns an appropriately localized/user-friendly message.
Security signals we found
Information disclosure: repr() of an exception could expose internal class/exception names or object state to the user, though typically low sensitivity.
No memory safety, cryptographic, authentication, or authorization changes.
No input validation, parsing, or network code modified.
Evidence from the diff
In electrum/gui/qt/init.py, the start_new_window method’s exception handler for wallet load failures was simplified. The previous code chose str(e) for WalletFileException and repr(e) for UserFacingException; the patch uniformly uses str(e). This is a presentation-layer change only and does not alter exception handling flow, crash reporting logic, or data processing.
Changed components
electrum/gui/qt/__init__.pyElectrumGui.start_new_window error dialogInspect captured patch +1 / −2
diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
index c083574..9c15154 100644
--- a/electrum/gui/qt/__init__.py
+++ b/electrum/gui/qt/__init__.py
@@ -413,11 +413,10 @@ class ElectrumGui(BaseElectrumGui, Logger):
self.logger.exception('')
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)
+ text=_('Cannot load wallet') + '(2) :\n' + str(e))
else:
send_exception_to_crash_reporter(e)
if app_is_starting:
Why this scored 18/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.