summary refs log tree commit diff
path: root/synapse/replication/http/send_event.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-08-01 15:04:50 +0100
committerRichard van der Hoff <richard@matrix.org>2018-08-01 16:02:46 +0100
commit01e93f48ed3dd78fda45a37733251659af19dde3 (patch)
treed3ce5dd798f8432c73a116d9e5005aba06f70520 /synapse/replication/http/send_event.py
parentRefactor code for turning HttpResponseException into SynapseError (diff)
downloadsynapse-01e93f48ed3dd78fda45a37733251659af19dde3.tar.xz
Kill off MatrixCodeMessageException
This code brings the SimpleHttpClient into line with the
MatrixFederationHttpClient by having it raise HttpResponseExceptions when a
request fails (rather than trying to parse for matrix errors and maybe raising
MatrixCodeMessageException).

Then, whenever we were checking for MatrixCodeMessageException and turning them
into SynapseErrors, we now need to check for HttpResponseExceptions and call
to_synapse_error.
Diffstat (limited to 'synapse/replication/http/send_event.py')
-rw-r--r--synapse/replication/http/send_event.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/synapse/replication/http/send_event.py b/synapse/replication/http/send_event.py
index 5227bc333d..d3509dc288 100644
--- a/synapse/replication/http/send_event.py
+++ b/synapse/replication/http/send_event.py
@@ -18,11 +18,7 @@ import re
 
 from twisted.internet import defer
 
-from synapse.api.errors import (
-    CodeMessageException,
-    MatrixCodeMessageException,
-    SynapseError,
-)
+from synapse.api.errors import CodeMessageException, HttpResponseException
 from synapse.events import FrozenEvent
 from synapse.events.snapshot import EventContext
 from synapse.http.servlet import RestServlet, parse_json_object_from_request
@@ -83,11 +79,11 @@ def send_event_to_master(clock, store, client, host, port, requester, event, con
             # If we timed out we probably don't need to worry about backing
             # off too much, but lets just wait a little anyway.
             yield clock.sleep(1)
-    except MatrixCodeMessageException as e:
+    except HttpResponseException 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)
+        raise e.to_synapse_error()
     defer.returnValue(result)