Skip to content

Commit deb3d4e

Browse files
committed
fix error logging exception
1 parent ffa4593 commit deb3d4e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

main.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def schemeSelected(schemeName, participantID, practiceOnly):
7474
logging.debug('Loaded scheme %s for participant %s' % (schemeName, participantID))
7575
except Exception as exc:
7676
QtGui.QMessageBox.critical(None, 'An error has occurred :(', '%s' % exc)
77-
77+
QtGui.QApplication.closeAllWindows()
7878
exc_type, exc_obj, exc_tb = sys.exc_info()
7979
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
80-
logging.error(exc_type, fname, exc_tb.tb_lineno)
81-
80+
logging.error('%s:%d - %s' % (fname, exc_tb.tb_lineno, exc))
81+
raise
8282
sys.exit(1)
8383

8484
def main(args):
@@ -88,7 +88,13 @@ def main(args):
8888
appWindow.show()
8989
appWindow.selected.connect(schemeSelected)
9090
appWindow.closed.connect(bailOut)
91-
app.exec_()
91+
try:
92+
app.exec_()
93+
except Exception as exc:
94+
exc_type, exc_obj, exc_tb = sys.exc_info()
95+
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
96+
logging.error('%s:%d - %s' % (fname, exc_tb.tb_lineno, exc))
97+
sys.exit(1)
9298

9399
if __name__ == '__main__':
94100
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)