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 <rea@codelabs.ru>
This commit is contained in:
Eygene Ryabinkin 2013-08-27 09:41:18 +04:00
parent d55e4ef15e
commit f2c858330f
1 changed files with 9 additions and 3 deletions

View File

@ -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"""