summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-07-01 14:33:14 -0300
committerdrebs <drebs@leap.se>2015-07-01 14:33:14 -0300
commita2fa8ab8b0135529234420555d3ab8890dad8d06 (patch)
tree972957ea7ffd52b21055c37bbe11d4ff25bdf86e
parent3122e3fd70b9bccf429f790241472b366313d324 (diff)
[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.
-rw-r--r--common/src/leap/soledad/common/couch.py6
1 files changed, 5 insertions, 1 deletions
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)