summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-08-01 14:58:16 +0100
committerRichard van der Hoff <richard@matrix.org>2018-08-01 16:02:46 +0100
commit018d75a148ced6945aca7b095a272e0edba5aae1 (patch)
treef56e8c5fb7bea4c9e8fff60edac82ec9ae187af5 /synapse/federation
parentBe more careful which errors we send back over the C-S API (diff)
downloadsynapse-018d75a148ced6945aca7b095a272e0edba5aae1.tar.xz
Refactor code for turning HttpResponseException into SynapseError
This commit replaces SynapseError.from_http_response_exception with
HttpResponseException.to_synapse_error.

The new method actually returns a ProxiedRequestError, which allows us to pass
through additional metadata from the API call.
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/federation_client.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py

index 0b09f93ca9..7550e11b6e 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py
@@ -506,7 +506,7 @@ class FederationClient(FederationBase): ) except HttpResponseException as e: if not 500 <= e.code < 600: - raise SynapseError.from_http_response_exception(e) + raise e.to_synapse_error() else: logger.warn( "Failed to %s via %s: %i %s", @@ -682,7 +682,7 @@ class FederationClient(FederationBase): ) except HttpResponseException as e: if e.code == 403: - raise SynapseError.from_http_response_exception(e) + raise e.to_synapse_error() raise pdu_dict = content["event"]