From a2fa8ab8b0135529234420555d3ab8890dad8d06 Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 1 Jul 2015 14:33:14 -0300 Subject: [bug] catch 'point is undefined' error on couch When trying to use an unexisting list function, to alter a view, the error is not a missing document error, but an obscure "TypeError" saying that "point is undefined" because of the way the javascript code in couchdb server tries to find the list function. This commit adds a catch for that error and raises the proper exception in the soledad couch module. --- common/src/leap/soledad/common/couch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/src/leap') diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py index 8d262ccd..ae9e7d2a 100644 --- a/common/src/leap/soledad/common/couch.py +++ b/common/src/leap/soledad/common/couch.py @@ -240,8 +240,12 @@ def raise_server_error(exc, ddoc_path): document for an yet unknown reason. """ path = "".join(ddoc_path) - if exc.message[1][0] == 'unnamed_error': + msg = exc.message[1][0] + if msg == 'unnamed_error': raise errors.MissingDesignDocListFunctionError(path) + elif msg == 'TypeError': + if 'point is undefined' in exc.message[1][1]: + raise errors.MissingDesignDocListFunctionError # other errors are unknown for now raise errors.DesignDocUnknownError(path) -- cgit v1.2.3