From 46c9f0fb5f5c435c59ca63d87534a9b87ce20f3f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 2 Aug 2020 15:03:17 +0200 Subject: [PATCH] Added more infor to the error dialog --- nw/error.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/nw/error.py b/nw/error.py index dd0cb109..cb276752 100644 --- a/nw/error.py +++ b/nw/error.py @@ -29,8 +29,11 @@ def formatHtmlErrMsg(exType, exValue, exTrace): """Generates a HTML version of an exception. """ try: + import sys from traceback import format_tb - from nw import __issuesurl__ + from nw import __issuesurl__, __version__ + from PyQt5.Qt import PYQT_VERSION_STR + from PyQt5.QtCore import QT_VERSION_STR, QSysInfo fmtTrace = "" for trEntry in format_tb(exTrace): @@ -41,11 +44,25 @@ def formatHtmlErrMsg(exType, exValue, exTrace): theMessage = ( "

Please report this error by submitting an issue report on " - "GitHub, providing a description and this error message.

" - "

Issue Tracker
%s

" - "

Error Type
%s: %s

" - "

Traceback
%s

" - ) % (__issuesurl__, exType.__name__, str(exValue), fmtTrace) + "GitHub, providing a description and this error message. " + "URL: <{issueUrl}>.

" + "

Environment
Version: {nwVersion}, OS: {osType} ({osKernel})," + "Python: {pyVersion} ({pyHexVer:#x}), Qt: {qtVers}, PyQt: {pyqtVers}

" + "

Error Type
{exType}: {exMessage}

" + "

Traceback
{exTrace}

" + ).format( + nwVersion = __version__, + osType = sys.platform, + osKernel = QSysInfo.kernelVersion(), + pyVersion = sys.version.split()[0], + pyHexVer = sys.hexversion, + qtVers = QT_VERSION_STR, + pyqtVers = PYQT_VERSION_STR, + issueUrl = __issuesurl__, + exType = exType.__name__, + exMessage = str(exValue), + exTrace = fmtTrace + ) return theMessage