summary refs log tree commit diff
path: root/synapse/replication/http/send_event.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-15 11:02:43 +0000
committerErik Johnston <erik@matrix.org>2018-02-15 11:03:49 +0000
commitef344b10e529d1c0b023f009a8aae806e8a981bc (patch)
tree02c2179c4205917c4c2e934408ad516ff4865670 /synapse/replication/http/send_event.py
parentMerge pull request #2867 from matrix-org/rav/rework_purge (diff)
downloadsynapse-ef344b10e529d1c0b023f009a8aae806e8a981bc.tar.xz
Don't log errors propogated from send_event
Diffstat (limited to 'synapse/replication/http/send_event.py')
-rw-r--r--synapse/replication/http/send_event.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/replication/http/send_event.py b/synapse/replication/http/send_event.py
index ff9b9d2f10..7b21a2213c 100644
--- a/synapse/replication/http/send_event.py
+++ b/synapse/replication/http/send_event.py
@@ -15,6 +15,7 @@
 
 from twisted.internet import defer
 
+from synapse.api.errors import SynapseError, MatrixCodeMessageException
 from synapse.events import FrozenEvent
 from synapse.events.snapshot import EventContext
 from synapse.http.servlet import RestServlet, parse_json_object_from_request
@@ -27,6 +28,7 @@ import re
 logger = logging.getLogger(__name__)
 
 
+@defer.inlineCallbacks
 def send_event_to_master(client, host, port, requester, event, context):
     """Send event to be handled on the master
 
@@ -48,7 +50,14 @@ def send_event_to_master(client, host, port, requester, event, context):
         "requester": requester.serialize(),
     }
 
-    return client.post_json_get_json(uri, payload)
+    try:
+        result = yield client.post_json_get_json(uri, payload)
+    except MatrixCodeMessageException as e:
+        # We convert to SynapseError as we know that it was a SynapseError
+        # on the master process that we should send to the client. (And
+        # importantly, not stack traces everywhere)
+        raise SynapseError(e.code, e.msg, e.errcode)
+    defer.returnValue(result)
 
 
 class ReplicationSendEventRestServlet(RestServlet):