Skip to content

Commit 650225e

Browse files
committed
crash reporter UX
see #5483
1 parent 28ca561 commit 650225e

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

electrum/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def read_json(filename, default):
3939
return r
4040

4141

42+
GIT_REPO_URL = "https://github.com/spesmilo/electrum"
43+
GIT_REPO_ISSUES_URL = "https://github.com/spesmilo/electrum/issues"
44+
45+
4246
class AbstractNet:
4347

4448
@classmethod

electrum/gui/qt/exception_window.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
from electrum.i18n import _
3434
from electrum.base_crash_reporter import BaseCrashReporter
3535
from electrum.logging import Logger
36+
from electrum import constants
37+
3638
from .util import MessageBoxMixin, read_QIcon, WaitingDialog
3739

3840

@@ -97,17 +99,22 @@ def __init__(self, main_window, exctype, value, tb):
9799

98100
def send_report(self):
99101
def on_success(response):
102+
# note: 'response' coming from (remote) crash reporter server.
103+
# It contains a URL to the GitHub issue, so we allow rich text.
100104
self.show_message(parent=self,
101105
title=_("Crash report"),
102-
msg=response)
106+
msg=response,
107+
rich_text=True)
103108
self.close()
104109
def on_failure(exc_info):
105110
e = exc_info[1]
106111
self.logger.error('There was a problem with the automatic reporting', exc_info=exc_info)
107112
self.show_critical(parent=self,
108-
msg=(_('There was a problem with the automatic reporting:') + '\n' +
109-
str(e) + '\n' +
110-
_("Please report this issue manually.")))
113+
msg=(_('There was a problem with the automatic reporting:') + '<br/>' +
114+
repr(e)[:120] + '<br/>' +
115+
_("Please report this issue manually") +
116+
f' <a href="{constants.GIT_REPO_ISSUES_URL}">on GitHub</a>.'),
117+
rich_text=True)
111118

112119
proxy = self.main_window.network.proxy
113120
task = lambda: BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, proxy)

electrum/gui/qt/main_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def show_update_check(self, version=None):
666666
def show_report_bug(self):
667667
msg = ' '.join([
668668
_("Please report any bugs as issues on github:<br/>"),
669-
"<a href=\"https://github.com/spesmilo/electrum/issues\">https://github.com/spesmilo/electrum/issues</a><br/><br/>",
669+
f'''<a href="{constants.GIT_REPO_ISSUES_URL}">{constants.GIT_REPO_ISSUES_URL}</a><br/><br/>''',
670670
_("Before reporting a bug, upgrade to the most recent version of Electrum (latest release or git HEAD), and include the version number in your report."),
671671
_("Try to explain not only what the bug is, but how it occurs.")
672672
])

electrum/logging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ def configure_logging(config):
243243
logging.getLogger('kivy').propagate = False
244244

245245
from . import ELECTRUM_VERSION
246-
_logger.info(f"Electrum version: {ELECTRUM_VERSION} - https://electrum.org - https://github.com/spesmilo/electrum")
246+
from .constants import GIT_REPO_URL
247+
_logger.info(f"Electrum version: {ELECTRUM_VERSION} - https://electrum.org - {GIT_REPO_URL}")
247248
_logger.info(f"Python version: {sys.version}. On platform: {describe_os_version()}")
248249
_logger.info(f"Logging to file: {str(_logfile_path)}")
249250
_logger.info(f"Log filters: verbosity {repr(verbosity)}, verbosity_shortcuts {repr(verbosity_shortcuts)}")

0 commit comments

Comments
 (0)