summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-14 14:25:14 +0100
committerGitHub <noreply@github.com>2019-06-14 14:25:14 +0100
commite9344e0dee59d0b255eee065108c56438fe73804 (patch)
treebc42d4552558a6d20caf009c1fc3fb8d52063fc3 /synapse/http
parentTrack deactivated accounts in the database (#5378) (diff)
parentNewsfile (diff)
downloadsynapse-e9344e0dee59d0b255eee065108c56438fe73804.tar.xz
Merge pull request #5390 from matrix-org/erikj/dont_log_on_fail_to_get_file
Don't log exception when failing to fetch remote content.
Diffstat (limited to 'synapse/http')
-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(