Added stacktrace to critical exception message box.

This commit is contained in:
Agnieszka Kostrzewa 2012-03-14 14:00:49 +01:00
parent fe545f2233
commit 7e0995ca25
2 changed files with 42 additions and 13 deletions

View File

@ -1382,14 +1382,28 @@ def handle_exception( exc_type, exc_value, exc_traceback ):
filename = os.path.basename( filename )
error = "%s: %s" % ( exc_type.__name__, exc_value )
QMessageBox.critical(None, "Houston, we have a problem...",
"Whoops. A critical error has occured. This is most likely a bug "
"in Qubes Manager.<br><br>"
"<b><i>%s</i></b>" % error +
"at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
% ( line, filename ))
strace = ""
stacktrace = traceback.extract_tb( exc_traceback )
while len(stacktrace) > 0:
(filename, line, func, txt) = stacktrace.pop()
strace += "----\n"
strace += "line: %s\n" %txt
strace += "func: %s\n" %func
strace += "line no.: %d\n" %line
strace += "file: %s\n" %filename
msg_box = QMessageBox()
msg_box.setDetailedText(strace)
msg_box.setIcon(QMessageBox.Critical)
msg_box.setWindowTitle( "Houston, we have a problem...")
msg_box.setText("Whoops. A critical error has occured. This is most likely a bug "
"in Qubes Manager.<br><br>"
"<b><i>%s</i></b>" % error +
"<br/>at line <b>%d</b><br/>of file %s.<br/><br/>"
% ( line, filename ))
msg_box.exec_()
#sys.exit(1)
def main():

View File

@ -630,12 +630,27 @@ def handle_exception( exc_type, exc_value, exc_traceback ):
filename = os.path.basename( filename )
error = "%s: %s" % ( exc_type.__name__, exc_value )
QMessageBox.critical(None, "Houston, we have a problem...",
"Whoops. A critical error has occured. This is most likely a bug "
"in Qubes VM Settings application.<br><br>"
"<b><i>%s</i></b>" % error +
"at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
% ( line, filename ))
strace = ""
stacktrace = traceback.extract_tb( exc_traceback )
while len(stacktrace) > 0:
(filename, line, func, txt) = stacktrace.pop()
strace += "----\n"
strace += "line: %s\n" %txt
strace += "func: %s\n" %func
strace += "line no.: %d\n" %line
strace += "file: %s\n" %filename
msg_box = QMessageBox()
msg_box.setDetailedText(strace)
msg_box.setIcon(QMessageBox.Critical)
msg_box.setWindowTitle( "Houston, we have a problem...")
msg_box.setText("Whoops. A critical error has occured. This is most likely a bug "
"in Qubes Manager.<br><br>"
"<b><i>%s</i></b>" % error +
"<br/>at line <b>%d</b><br/>of file %s.<br/><br/>"
% ( line, filename ))
msg_box.exec_()
def main():