MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / displayErrorMessage

Function displayErrorMessage

zeronet.py:50–71  ·  view source on GitHub ↗
(err, error_log_path)

Source from the content-addressed store, hash-verified

48
49
50def displayErrorMessage(err, error_log_path):
51 import ctypes
52 import urllib.parse
53 import subprocess
54
55 MB_YESNOCANCEL = 0x3
56 MB_ICONEXCLAIMATION = 0x30
57
58 ID_YES = 0x6
59 ID_NO = 0x7
60 ID_CANCEL = 0x2
61
62 err_message = "%s: %s" % (type(err).__name__, err)
63 err_title = "Unhandled exception: %s\nReport error?" % err_message
64
65 res = ctypes.windll.user32.MessageBoxW(0, err_title, "ZeroNet error", MB_YESNOCANCEL | MB_ICONEXCLAIMATION)
66 if res == ID_YES:
67 import webbrowser
68 report_url = "https://github.com/HelloZeroNet/ZeroNet/issues/new?assignees=&labels=&template=bug-report.md&title=%s"
69 webbrowser.open(report_url % urllib.parse.quote("Unhandled exception: %s" % err_message))
70 if res in [ID_YES, ID_NO]:
71 subprocess.Popen(['notepad.exe', error_log_path])
72
73def prepareShutdown():
74 import atexit

Callers 1

mainFunction · 0.85

Calls 1

openMethod · 0.80

Tested by

no test coverage detected