add useful (hopefully) exception handler

This commit is contained in:
sqlcoder 2009-07-31 22:34:26 +01:00
parent f3a4a8b0d0
commit 3b9fa3b177

View File

@ -159,6 +159,7 @@ class GuiAutoImport (threading.Thread):
# - Ideally we want to release the lock if the auto-import is killed by some
# kind of exception - is this possible?
if self.settings['global_lock'].acquire(False): # returns false immediately if lock not acquired
try:
print "\nGlobal lock taken ..."
self.doAutoImportBool = True
widget.set_label(u' _Stop Autoimport ')
@ -182,6 +183,9 @@ class GuiAutoImport (threading.Thread):
interval=int(self.intervalEntry.get_text())
gobject.timeout_add(interval*1000, self.do_import)
except:
err = traceback.extract_tb(sys.exc_info()[2])[-1]
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
else:
print "auto-import aborted - global lock not available"
else: # toggled off