on exception during a SQL execute, show user the SQL line that caused the exception

This commit is contained in:
Jonathan Warren 2013-05-16 13:04:30 -04:00
parent 17a8ece5c1
commit dfd91d35af
2 changed files with 9 additions and 4 deletions

View File

@ -2446,7 +2446,15 @@ class sqlThread(threading.Thread):
parameters = shared.sqlSubmitQueue.get() parameters = shared.sqlSubmitQueue.get()
#print 'item', item #print 'item', item
#print 'parameters', parameters #print 'parameters', parameters
try:
self.cur.execute(item, parameters) 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.sqlReturnQueue.put(self.cur.fetchall())
#shared.sqlSubmitQueue.task_done() #shared.sqlSubmitQueue.task_done()

View File

@ -230,9 +230,6 @@ class MyForm(QtGui.QMainWindow):
if isEnabled: if isEnabled:
status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile) status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile)
#self.sqlLookup = sqlThread()
#self.sqlLookup.start()
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
font = QFont() font = QFont()
font.setBold(True) font.setBold(True)