From dfd91d35af60bf9c26f2381959f703086499bb0d Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Thu, 16 May 2013 13:04:30 -0400 Subject: [PATCH] on exception during a SQL execute, show user the SQL line that caused the exception --- src/bitmessagemain.py | 10 +++++++++- src/bitmessageqt/__init__.py | 3 --- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index b51c73fc..5dbd6915 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -2446,7 +2446,15 @@ class sqlThread(threading.Thread): parameters = shared.sqlSubmitQueue.get() #print 'item', item #print 'parameters', parameters - self.cur.execute(item, parameters) + try: + self.cur.execute(item, parameters) + except Exception, err: + shared.printLock.acquire() + sys.stderr.write('\nMajor error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "'+str(item) + '" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: '+str(repr(parameters))+'\nHere is the actual error message thrown by the sqlThread: '+ str(err)+'\n') + sys.stderr.write('This program shall now abruptly exit!\n') + shared.printLock.release() + os._exit(0) + shared.sqlReturnQueue.put(self.cur.fetchall()) #shared.sqlSubmitQueue.task_done() diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 86ac868f..5233a532 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -230,9 +230,6 @@ class MyForm(QtGui.QMainWindow): if isEnabled: status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile) - #self.sqlLookup = sqlThread() - #self.sqlLookup.start() - self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent font = QFont() font.setBold(True)