summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-17 14:10:28 +0100
committerErik Johnston <erik@matrix.org>2019-06-17 14:10:28 +0100
commitc08e4dbadc36d5547d4ff14ec4d985823666fb80 (patch)
tree3a79f31f2785db645e5f28088c63e8e06c01c0ca /synapse/http/client.py
parentMerge branch 'master' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #5385 from matrix-org/erikj/reduce_http_exceptions (diff)
downloadsynapse-c08e4dbadc36d5547d4ff14ec4d985823666fb80.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py

index 77fe68818b..5c073fff07 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py
@@ -17,7 +17,7 @@ import logging from io import BytesIO -from six import text_type +from six import raise_from, text_type from six.moves import urllib import treq @@ -542,10 +542,15 @@ class SimpleHttpClient(object): length = yield make_deferred_yieldable( _readBodyToFile(response, output_stream, max_size) ) + except SynapseError: + # This can happen e.g. because the body is too large. + raise except Exception as e: - logger.exception("Failed to download body") - raise SynapseError( - 502, ("Failed to download remote body: %s" % e), Codes.UNKNOWN + raise_from( + SynapseError( + 502, ("Failed to download remote body: %s" % e), + ), + e ) defer.returnValue(