diff options
author | drebs <drebs@leap.se> | 2017-03-12 15:39:33 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-03-17 17:30:43 +0100 |
commit | 0c227c30ee20b1af4518ecf56848b06572b4ed72 (patch) | |
tree | 957449f1d9ee745491966e86f6f14d01905a08b2 /src/leap/mx | |
parent | 03dcf4fcdf67f02dd913e85e89bbd6cc2a377bd9 (diff) |
Fix logging of couchdb errors.
Leap MX was previously wrapping soledad's couchdb-related exceptions
messages in its own exception. The problem was that message attribute of
those exceptions were actually empty, and so the information of the
actual error was lost. This commit removes the wrapper exception and
forwards whatever exception was received from soledad to the logging
system.
Signed-off-by: Ruben Pollan <meskio@sindominio.net>
Diffstat (limited to 'src/leap/mx')
-rw-r--r-- | src/leap/mx/couchdbhelper.py | 9 | ||||
-rw-r--r-- | src/leap/mx/tests/test_mail_receiver.py | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/leap/mx/couchdbhelper.py b/src/leap/mx/couchdbhelper.py index 50275ca..eafc620 100644 --- a/src/leap/mx/couchdbhelper.py +++ b/src/leap/mx/couchdbhelper.py @@ -184,7 +184,8 @@ class ConnectedCouchDB(client.CouchDB): :return: A deferred which fires with the new revision identifier for the document if the Document object has being updated, or - which fails with CouchDBError if there was any error. + which fails with the correspondent exception if there was any + error. """ # TODO: that should be implemented with paisley url = self._mail_couch_url + "/user-%s" % (uuid,) @@ -192,8 +193,4 @@ class ConnectedCouchDB(client.CouchDB): db = CouchDatabase.open_database(url, create=False) return defer.succeed(db.put_doc(doc)) except Exception as e: - return defer.fail(CouchDBError(e.message)) - - -class CouchDBError(Exception): - pass + return defer.fail(e) diff --git a/src/leap/mx/tests/test_mail_receiver.py b/src/leap/mx/tests/test_mail_receiver.py index 33967ea..6b274cd 100644 --- a/src/leap/mx/tests/test_mail_receiver.py +++ b/src/leap/mx/tests/test_mail_receiver.py @@ -19,7 +19,6 @@ MailReceiver tests """ -import codecs import json import os import os.path @@ -31,7 +30,6 @@ from twisted.internet import defer, reactor from twisted.trial import unittest from leap.keymanager import openpgp -from leap.mx.couchdbhelper import CouchDBError from leap.mx.mail_receiver import MailReceiver @@ -91,7 +89,7 @@ class MailReceiverTestCase(unittest.TestCase): def put_doc_raise(*args): defer_called.callback(None) - return defer.fail(CouchDBError()) + return defer.fail(Exception()) self.users_cdb.put_doc = put_doc_raise _, path = self.addMail() |