##// END OF EJS Templates
Catch errors in history save thread, and print a briefer error message, rather than an ugly traceback.
Thomas Kluyver -
Show More
@@ -486,13 +486,17 b' class HistorySavingThread(threading.Thread):'
486
486
487 def run(self):
487 def run(self):
488 # We need a separate db connection per thread:
488 # We need a separate db connection per thread:
489 self.db = sqlite3.connect(self.history_manager.hist_file)
489 try:
490 while True:
490 self.db = sqlite3.connect(self.history_manager.hist_file)
491 self.history_manager.save_flag.wait()
491 while True:
492 if self.stop_now:
492 self.history_manager.save_flag.wait()
493 return
493 if self.stop_now:
494 self.history_manager.save_flag.clear()
494 return
495 self.history_manager.writeout_cache(self.db)
495 self.history_manager.save_flag.clear()
496 self.history_manager.writeout_cache(self.db)
497 except Exception as e:
498 print(("The history saving thread hit an unexpected error (%s)."
499 "History will not be written to the database.") % repr(e))
496
500
497 def stop(self):
501 def stop(self):
498 """This can be called from the main thread to safely stop this thread.
502 """This can be called from the main thread to safely stop this thread.
General Comments 0
You need to be logged in to leave comments. Login now