From 3a6256480bffaca6a24decf742150ffe8080a2e3 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Tue, 27 Aug 2013 09:41:18 +0400 Subject: [PATCH] Always show full tracebacks at the end of the run This greatly simplifies developer's life and will, possibly, allow users familiar with Python to debug and fix the problems by themselves. We, possibly, should not give tracebacks for the problems like "can't open connection", but this is up to the caller of this routine not to provide traceback in this case. Signed-off-by: Eygene Ryabinkin --- offlineimap/ui/UIBase.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py index 2c30b94..8558421 100644 --- a/offlineimap/ui/UIBase.py +++ b/offlineimap/ui/UIBase.py @@ -124,6 +124,11 @@ class UIBase(object): of the sync run when offlineiamp exits. It is recommended to always pass in exceptions if possible, so we can give the user the best debugging info. + + We are always pushing tracebacks to the exception queue to + make them to be output at the end of the run to allow users + pass sensible diagnostics to the developers or to solve + problems by themselves. One example of such a call might be: @@ -135,13 +140,14 @@ class UIBase(object): else: self._msg("ERROR: %s" % (exc)) + instant_traceback = exc_traceback if not self.debuglist: # only output tracebacks in debug mode - exc_traceback = None + instant_traceback = None # push exc on the queue for later output self.exc_queue.put((msg, exc, exc_traceback)) - if exc_traceback: - self._msg(traceback.format_tb(exc_traceback)) + if instant_traceback: + self._msg(traceback.format_tb(instant_traceback)) def registerthread(self, account): """Register current thread as being associated with an account name""" -- 1.8.1.3