mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-19 05:14:18 -05:00
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.
This commit is contained in:
commit
e9344e0dee
1
changelog.d/5390.bugfix
Normal file
1
changelog.d/5390.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix handling of failures fetching remote content to not log failures as exceptions.
|
@ -17,7 +17,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from six import text_type
|
from six import raise_from, text_type
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
import treq
|
import treq
|
||||||
@ -542,10 +542,15 @@ class SimpleHttpClient(object):
|
|||||||
length = yield make_deferred_yieldable(
|
length = yield make_deferred_yieldable(
|
||||||
_readBodyToFile(response, output_stream, max_size)
|
_readBodyToFile(response, output_stream, max_size)
|
||||||
)
|
)
|
||||||
|
except SynapseError:
|
||||||
|
# This can happen e.g. because the body is too large.
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Failed to download body")
|
raise_from(
|
||||||
raise SynapseError(
|
SynapseError(
|
||||||
502, ("Failed to download remote body: %s" % e), Codes.UNKNOWN
|
502, ("Failed to download remote body: %s" % e),
|
||||||
|
),
|
||||||
|
e
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(
|
defer.returnValue(
|
||||||
|
@ -386,8 +386,10 @@ class MediaRepository(object):
|
|||||||
raise SynapseError(502, "Failed to fetch remote media")
|
raise SynapseError(502, "Failed to fetch remote media")
|
||||||
|
|
||||||
except SynapseError:
|
except SynapseError:
|
||||||
logger.exception("Failed to fetch remote media %s/%s",
|
logger.warn(
|
||||||
server_name, media_id)
|
"Failed to fetch remote media %s/%s",
|
||||||
|
server_name, media_id,
|
||||||
|
)
|
||||||
raise
|
raise
|
||||||
except NotRetryingDestination:
|
except NotRetryingDestination:
|
||||||
logger.warn("Not retrying destination %r", server_name)
|
logger.warn("Not retrying destination %r", server_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user