diff options
author | Erik Johnston <erik@matrix.org> | 2019-06-07 12:34:52 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-06-07 12:39:10 +0100 |
commit | 95d38afe96bfb38e02de9767603b2655c07a7e0f (patch) | |
tree | c852e77d75cef0adb4fbfe76c06754e4b99018f8 /synapse/http/client.py | |
parent | Merge tag 'v1.0.0rc1' into develop (diff) | |
download | synapse-95d38afe96bfb38e02de9767603b2655c07a7e0f.tar.xz |
Don't log exception when failing to fetch remote content.
In particular, let's not log stack traces when we stop processing becuase the response body was too large.
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r-- | synapse/http/client.py | 13 |
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( |