mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-09 15:02:37 +00:00
Improve error msg when key-fetch fails (#5896)
There's no point doing a raise_from here, because the exception is always logged at warn with no stacktrace in the caller. Instead, let's try to give better messages to reduce confusion. In particular, this means that we won't log 'Failed to connect to remote server' when we don't even attempt to connect to the remote server due to blacklisting.
This commit is contained in:
parent
4dab867288
commit
ef1c524bb3
1
changelog.d/5896.misc
Normal file
1
changelog.d/5896.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve the logging when we have an error when fetching signing keys.
|
@ -18,7 +18,6 @@ import logging
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from six import raise_from
|
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
@ -657,9 +656,10 @@ class PerspectivesKeyFetcher(BaseV2KeyFetcher):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
except (NotRetryingDestination, RequestSendFailed) as e:
|
except (NotRetryingDestination, RequestSendFailed) as e:
|
||||||
raise_from(KeyLookupError("Failed to connect to remote server"), e)
|
# these both have str() representations which we can't really improve upon
|
||||||
|
raise KeyLookupError(str(e))
|
||||||
except HttpResponseException as e:
|
except HttpResponseException as e:
|
||||||
raise_from(KeyLookupError("Remote server returned an error"), e)
|
raise KeyLookupError("Remote server returned an error: %s" % (e,))
|
||||||
|
|
||||||
keys = {}
|
keys = {}
|
||||||
added_keys = []
|
added_keys = []
|
||||||
@ -821,9 +821,11 @@ class ServerKeyFetcher(BaseV2KeyFetcher):
|
|||||||
timeout=10000,
|
timeout=10000,
|
||||||
)
|
)
|
||||||
except (NotRetryingDestination, RequestSendFailed) as e:
|
except (NotRetryingDestination, RequestSendFailed) as e:
|
||||||
raise_from(KeyLookupError("Failed to connect to remote server"), e)
|
# these both have str() representations which we can't really improve
|
||||||
|
# upon
|
||||||
|
raise KeyLookupError(str(e))
|
||||||
except HttpResponseException as e:
|
except HttpResponseException as e:
|
||||||
raise_from(KeyLookupError("Remote server returned an error"), e)
|
raise KeyLookupError("Remote server returned an error: %s" % (e,))
|
||||||
|
|
||||||
if response["server_name"] != server_name:
|
if response["server_name"] != server_name:
|
||||||
raise KeyLookupError(
|
raise KeyLookupError(
|
||||||
|
Loading…
Reference in New Issue
Block a user