summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-03-13 16:16:33 +0100
committerdrebs <drebs@leap.se>2017-03-13 16:16:33 +0100
commit739fa78ad984836ed2d16e16850cc46b4c40748d (patch)
tree718f0db6f8923c83ff302dfa7159c1919a472d75
parente779ecd3be6bfe45f2bd082e890e1c600785e676 (diff)
[bug] fix raising of invalid auth token error
-rw-r--r--client/src/leap/soledad/client/http_target/api.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/http_target/api.py b/client/src/leap/soledad/client/http_target/api.py
index 1b086a00..fc65c9bd 100644
--- a/client/src/leap/soledad/client/http_target/api.py
+++ b/client/src/leap/soledad/client/http_target/api.py
@@ -21,13 +21,13 @@ import base64
from StringIO import StringIO
from uuid import uuid4
-from twisted.web.error import Error
from twisted.internet import defer
from twisted.web.http_headers import Headers
from twisted.web.client import FileBodyProducer
from leap.soledad.client.http_target.support import readBody
from leap.soledad.common.errors import InvalidAuthTokenError
+from leap.soledad.common.l2db.errors import HTTPError
from leap.soledad.common.l2db import SyncTarget
@@ -242,7 +242,7 @@ def _unauth_to_invalid_token_error(failure):
:return: Either the original failure or an invalid auth token error.
:rtype: twisted.python.failure.Failure
"""
- failure.trap(Error)
- if failure.getErrorMessage() == "401 Unauthorized":
+ failure.trap(HTTPError)
+ if failure.value.status == 401:
raise InvalidAuthTokenError
return failure