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:
parent
d55e4ef15e
commit
f2c858330f
@ -125,6 +125,11 @@ class UIBase(object):
|
|||||||
always pass in exceptions if possible, so we can give the user
|
always pass in exceptions if possible, so we can give the user
|
||||||
the best debugging info.
|
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:
|
One example of such a call might be:
|
||||||
|
|
||||||
ui.error(exc, sys.exc_info()[2], msg="While syncing Folder %s in "
|
ui.error(exc, sys.exc_info()[2], msg="While syncing Folder %s in "
|
||||||
@ -135,13 +140,14 @@ class UIBase(object):
|
|||||||
else:
|
else:
|
||||||
self._msg("ERROR: %s" % (exc))
|
self._msg("ERROR: %s" % (exc))
|
||||||
|
|
||||||
|
instant_traceback = exc_traceback
|
||||||
if not self.debuglist:
|
if not self.debuglist:
|
||||||
# only output tracebacks in debug mode
|
# only output tracebacks in debug mode
|
||||||
exc_traceback = None
|
instant_traceback = None
|
||||||
# push exc on the queue for later output
|
# push exc on the queue for later output
|
||||||
self.exc_queue.put((msg, exc, exc_traceback))
|
self.exc_queue.put((msg, exc, exc_traceback))
|
||||||
if exc_traceback:
|
if instant_traceback:
|
||||||
self._msg(traceback.format_tb(exc_traceback))
|
self._msg(traceback.format_tb(instant_traceback))
|
||||||
|
|
||||||
def registerthread(self, account):
|
def registerthread(self, account):
|
||||||
"""Register current thread as being associated with an account name"""
|
"""Register current thread as being associated with an account name"""
|
||||||
|
Loading…
Reference in New Issue
Block a user