Skip to content

Commit

Permalink
Include platform info with exception report
Browse files Browse the repository at this point in the history
This adds platform (OS) to the runtime information in the exception
report.
  • Loading branch information
duk3luk3 committed Aug 25, 2017
1 parent e19db6b commit de7b7bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def excepthook(exc_type, exc_value, traceback_object):
sys.excepthook = excepthook_original

logger.error("Uncaught exception", exc_info=(exc_type, exc_value, traceback_object))
logger.error("Runtime Info:\n%s", util.runtime_info())
dialog = util.CrashDialog((exc_type, exc_value, traceback_object))
answer = dialog.exec_()

Expand Down
2 changes: 1 addition & 1 deletion src/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,4 @@ def datetostr(d):
def now():
return _dateDummy.now()

from .crash import CrashDialog
from .crash import CrashDialog, runtime_info
37 changes: 22 additions & 15 deletions src/util/crash.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import traceback
import util
from config import Settings
import platform

from . import APPDATA_DIR, PERSONAL_DIR, VERSION_STRING

Expand All @@ -13,6 +14,26 @@

FormClass, BaseClass = util.THEME.loadUiType("client/crash.ui")

def runtime_info():
try:
desc = []
desc.append(("FAF Username", CRASH_REPORT_USER))
desc.append(("FAF Version", VERSION_STRING))
desc.append(("FAF Environment", config.environment))
desc.append(("FAF Directory", APPDATA_DIR))
fa_path = util.settings.value("ForgedAlliance/app/path",
"Unknown",
type=str)
desc.append(("FA Path: ", fa_path))
desc.append(("Home Directory", PERSONAL_DIR))
desc.append(("Platform", platform.platform()))
desc.append(("Uname", str(platform.uname())))

desc = "".join(["{}: {}\n".format(n, d) for n, d in desc])
except Exception:
desc = "(Exception raised while writing runtime info)\n"

return desc

class CrashDialog(FormClass, BaseClass):
def __init__(self, exc_info, *args, **kwargs):
Expand All @@ -21,21 +42,7 @@ def __init__(self, exc_info, *args, **kwargs):

trace = "".join(traceback.format_exception(*exc_info, limit=10))

try:
desc = []
desc.append(("FAF Username", CRASH_REPORT_USER))
desc.append(("FAF Version", VERSION_STRING))
desc.append(("FAF Environment", config.environment))
desc.append(("FAF Directory", APPDATA_DIR))
fa_path = util.settings.value("ForgedAlliance/app/path",
"Unknown",
type=str)
desc.append(("FA Path: ", fa_path))
desc.append(("Home Directory", PERSONAL_DIR))

desc = "".join(["{}: {}\n".format(n, d) for n, d in desc])
except Exception:
desc = "(Exception raised while writing runtime info)\n"
desc = runtime_info()

self.logField.setText("{}\nRuntime info:\n\n{}".format(trace, desc))

Expand Down

0 comments on commit de7b7bd

Please sign in to comment.