summary refs log tree commit diff
path: root/synapse/rest/media
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/rest/media
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/rest/media')
-rw-r--r--synapse/rest/media/v1/media_repository.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py
index 174ad20123..8fb413d825 100644
--- a/synapse/rest/media/v1/media_repository.py
+++ b/synapse/rest/media/v1/media_repository.py
@@ -379,7 +379,7 @@ class MediaRepository(object):
                 logger.warn("HTTP error fetching remote media %s/%s: %s",
                             server_name, media_id, e.response)
                 if e.code == twisted.web.http.NOT_FOUND:
-                    raise SynapseError.from_http_response_exception(e)
+                    raise e.to_synapse_error()
                 raise SynapseError(502, "Failed to fetch remote media")
 
             except SynapseError: