mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-19 16:53:59 +01:00
Need the HTTP status code
This commit is contained in:
parent
70caf49914
commit
a46982cee9
1 changed files with 5 additions and 5 deletions
|
@ -323,7 +323,7 @@ class MatrixProxyClient(object):
|
||||||
result = yield self.simpleHttpClient.post_json_get_json(uri, post_json)
|
result = yield self.simpleHttpClient.post_json_get_json(uri, post_json)
|
||||||
defer.returnValue(result)
|
defer.returnValue(result)
|
||||||
except CodeMessageException as cme:
|
except CodeMessageException as cme:
|
||||||
ex = self._tryGetMatrixError(cme.msg)
|
ex = self._tryGetMatrixError(cme)
|
||||||
if ex is not None:
|
if ex is not None:
|
||||||
raise ex
|
raise ex
|
||||||
raise cme
|
raise cme
|
||||||
|
@ -334,17 +334,17 @@ class MatrixProxyClient(object):
|
||||||
result = yield self.simpleHttpClient.get_json(uri, args)
|
result = yield self.simpleHttpClient.get_json(uri, args)
|
||||||
defer.returnValue(result)
|
defer.returnValue(result)
|
||||||
except CodeMessageException as cme:
|
except CodeMessageException as cme:
|
||||||
ex = self._tryGetMatrixError(cme.msg)
|
ex = self._tryGetMatrixError(cme)
|
||||||
if ex is not None:
|
if ex is not None:
|
||||||
raise ex
|
raise ex
|
||||||
raise cme
|
raise cme
|
||||||
|
|
||||||
def _tryGetMatrixError(self, body):
|
def _tryGetMatrixError(self, codeMessageException):
|
||||||
try:
|
try:
|
||||||
errbody = json.loads(body)
|
errbody = json.loads(codeMessageException.msg)
|
||||||
errcode = errbody['errcode']
|
errcode = errbody['errcode']
|
||||||
errtext = errbody['error']
|
errtext = errbody['error']
|
||||||
return SynapseError(cme.code, errtext, errcode)
|
return SynapseError(codeMessageException.code, errtext, errcode)
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue