Skip to content

Commit

Permalink
crash reporter UX
Browse files Browse the repository at this point in the history
see #5483
  • Loading branch information
SomberNight committed Jul 4, 2019
1 parent 28ca561 commit 650225e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions electrum/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def read_json(filename, default):
return r


GIT_REPO_URL = "https://github.com/spesmilo/electrum"
GIT_REPO_ISSUES_URL = "https://github.com/spesmilo/electrum/issues"


class AbstractNet:

@classmethod
Expand Down
15 changes: 11 additions & 4 deletions electrum/gui/qt/exception_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
from electrum.i18n import _
from electrum.base_crash_reporter import BaseCrashReporter
from electrum.logging import Logger
from electrum import constants

from .util import MessageBoxMixin, read_QIcon, WaitingDialog


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

def send_report(self):
def on_success(response):
# note: 'response' coming from (remote) crash reporter server.
# It contains a URL to the GitHub issue, so we allow rich text.
self.show_message(parent=self,
title=_("Crash report"),
msg=response)
msg=response,
rich_text=True)
self.close()
def on_failure(exc_info):
e = exc_info[1]
self.logger.error('There was a problem with the automatic reporting', exc_info=exc_info)
self.show_critical(parent=self,
msg=(_('There was a problem with the automatic reporting:') + '\n' +
str(e) + '\n' +
_("Please report this issue manually.")))
msg=(_('There was a problem with the automatic reporting:') + '<br/>' +
repr(e)[:120] + '<br/>' +
_("Please report this issue manually") +
f' <a href="{constants.GIT_REPO_ISSUES_URL}">on GitHub</a>.'),
rich_text=True)

proxy = self.main_window.network.proxy
task = lambda: BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, proxy)
Expand Down
2 changes: 1 addition & 1 deletion electrum/gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def show_update_check(self, version=None):
def show_report_bug(self):
msg = ' '.join([
_("Please report any bugs as issues on github:<br/>"),
"<a href=\"https://github.com/spesmilo/electrum/issues\">https://github.com/spesmilo/electrum/issues</a><br/><br/>",
f'''<a href="{constants.GIT_REPO_ISSUES_URL}">{constants.GIT_REPO_ISSUES_URL}</a><br/><br/>''',
_("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."),
_("Try to explain not only what the bug is, but how it occurs.")
])
Expand Down
3 changes: 2 additions & 1 deletion electrum/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ def configure_logging(config):
logging.getLogger('kivy').propagate = False

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

0 comments on commit 650225e

Please sign in to comment.