def exception_hook(exception_type, message, traceback):
"""
An exception hook that will display a GUI and optionally allow the user
to submit a GitHub issue.
:param exception_type:
The type of exception that was raised.
:param message:
The exception message.
:param traceback:
The traceback of the exception.
"""
# Show the exception in the terminal.
sys._excepthook(exception_type, message, traceback)
# Should this exception be ignored?
if message.__repr__() in ignore_exception_messages:
return None
# Load a GUI that shows the exception.
exception_gui = exception.ExceptionWidget(
exception_type, message, traceback)
exception_gui.exec_()
# Ignore future exceptions of this kind?
if exception_gui.ignore_in_future:
ignore_exception_messages.append(message.__repr__())
return None
评论列表
文章目录