forked from MirrorHub/synapse
Merge pull request #4723 from matrix-org/erikj/frontend_proxy_exception
Correctly proxy exception in frontend_proxy worker
This commit is contained in:
commit
5b9786ee00
2 changed files with 11 additions and 5 deletions
1
changelog.d/4723.misc
Normal file
1
changelog.d/4723.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Correctly proxy exception in frontend_proxy worker
|
|
@ -21,7 +21,7 @@ from twisted.web.resource import NoResource
|
||||||
|
|
||||||
import synapse
|
import synapse
|
||||||
from synapse import events
|
from synapse import events
|
||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import HttpResponseException, SynapseError
|
||||||
from synapse.app import _base
|
from synapse.app import _base
|
||||||
from synapse.config._base import ConfigError
|
from synapse.config._base import ConfigError
|
||||||
from synapse.config.homeserver import HomeServerConfig
|
from synapse.config.homeserver import HomeServerConfig
|
||||||
|
@ -66,10 +66,15 @@ class PresenceStatusStubServlet(ClientV1RestServlet):
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": auth_headers,
|
"Authorization": auth_headers,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
result = yield self.http_client.get_json(
|
result = yield self.http_client.get_json(
|
||||||
self.main_uri + request.uri.decode('ascii'),
|
self.main_uri + request.uri.decode('ascii'),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
|
except HttpResponseException as e:
|
||||||
|
raise e.to_synapse_error()
|
||||||
|
|
||||||
defer.returnValue((200, result))
|
defer.returnValue((200, result))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in a new issue