[PATCH 3/3] Properly output errors when the main thread receives some

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Aug 22 11:12:07 BST 2011


Use the ui.error infrastructure that has been put in place and use
ui.terminate even if we received an Exception, so that we can output the
list of errors that we have. This does away with 2 now unused functions
in ui/UIBase.py

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
This third patch is optional but a nice cleanup when I added the Error
throwing in the previous patch.

 offlineimap/init.py      |    3 ++-
 offlineimap/ui/UIBase.py |    8 --------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/offlineimap/init.py b/offlineimap/init.py
index e5560a9..063a2c0 100644
--- a/offlineimap/init.py
+++ b/offlineimap/init.py
@@ -347,7 +347,8 @@ class OfflineImap:
         except (SystemExit):
             raise
         except Exception, e:
-            ui.mainException()
+            ui.error(e)
+            ui.terminate()
 
     def sync_singlethreaded(self, accs, config):
         """Executed if we do not want a separate syncmaster thread
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index 16e10bc..2994610 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -344,14 +344,6 @@ class UIBase:
         s.delThreadDebugLog(thread)
         s.terminate(100)
 
-    def getMainExceptionString(s):
-        return "Main program terminated with exception:\n%s\n" %\
-               traceback.format_exc() + \
-               s.getThreadDebugLog(threading.currentThread())
-
-    def mainException(s):
-        s._msg(s.getMainExceptionString())
-
     def terminate(self, exitstatus = 0, errortitle = None, errormsg = None):
         """Called to terminate the application."""
         #print any exceptions that have occurred over the run
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list