diff options
author | drebs <drebs@leap.se> | 2015-04-27 15:08:10 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2015-04-28 21:34:35 -0300 |
commit | 512d744da3e6836020feb5a71d949c5dad23db58 (patch) | |
tree | 64470d33cb0cea3814ef59c638169c0136143243 | |
parent | c7996bf4bfe489a7c0341a27bb2bcf49245fbca7 (diff) |
[bug] log traceback on sync failures on client
Conversion of Twisted failures to string that rely on __str__ or __repr__
might not return all the information we would like to have, especially on sync
failures. This commit asks for a detailed traceback of such failures and logs
them both in Twisted and client logs.
-rw-r--r-- | client/src/leap/soledad/client/api.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py index b2cabe08..ce026cdf 100644 --- a/client/src/leap/soledad/client/api.py +++ b/client/src/leap/soledad/client/api.py @@ -39,12 +39,11 @@ try: except ImportError: import chardet +from StringIO import StringIO from u1db.remote import http_client from u1db.remote.ssl_match_hostname import match_hostname from zope.interface import implements -from twisted.python import log - from leap.common.config import get_path_prefix from leap.soledad.common import SHARED_DB_NAME @@ -663,8 +662,10 @@ class Soledad(object): # that logs the failure and does not propagate it down the callback # chain def _errback(failure): - log.err(failure) - logger.error("Soledad exception when syncing: %s" % str(failure)) + s = StringIO() + failure.printDetailedTraceback(file=s) + msg = "Soledad exception when syncing!\n" + s.getvalue() + logger.error(msg) d.addCallbacks(on_sync_done, _errback) return d |