diff options
author | David Baker <dave@matrix.org> | 2017-04-21 16:20:12 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2017-04-21 16:20:12 +0100 |
commit | a46982cee9308294da0fcd99e06a5f1b7a7c439a (patch) | |
tree | f6995f70cc439b838d2d30ea6252c56ef3daa5a6 /synapse/http | |
parent | Do the same for get_json (diff) | |
download | synapse-a46982cee9308294da0fcd99e06a5f1b7a7c439a.tar.xz |
Need the HTTP status code
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/client.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 4458855cec..df8c3e3c2c 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -323,7 +323,7 @@ class MatrixProxyClient(object): result = yield self.simpleHttpClient.post_json_get_json(uri, post_json) defer.returnValue(result) except CodeMessageException as cme: - ex = self._tryGetMatrixError(cme.msg) + ex = self._tryGetMatrixError(cme) if ex is not None: raise ex raise cme @@ -334,17 +334,17 @@ class MatrixProxyClient(object): result = yield self.simpleHttpClient.get_json(uri, args) defer.returnValue(result) except CodeMessageException as cme: - ex = self._tryGetMatrixError(cme.msg) + ex = self._tryGetMatrixError(cme) if ex is not None: raise ex raise cme - def _tryGetMatrixError(self, body): + def _tryGetMatrixError(self, codeMessageException): try: - errbody = json.loads(body) + errbody = json.loads(codeMessageException.msg) errcode = errbody['errcode'] errtext = errbody['error'] - return SynapseError(cme.code, errtext, errcode) + return SynapseError(codeMessageException.code, errtext, errcode) except: return None |