diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-08-22 10:42:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-22 10:42:06 +0100 |
commit | ef1c524bb381545761fdd1ad2a61db1693ddbd3d (patch) | |
tree | aaca0006619b510aa1a42ece67b9a93ccb508a64 /synapse | |
parent | Drop some unused tables. (#5893) (diff) | |
download | synapse-ef1c524bb381545761fdd1ad2a61db1693ddbd3d.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | synapse/crypto/keyring.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py index 6c3e885e72..654accc843 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py @@ -18,7 +18,6 @@ import logging from collections import defaultdict import six -from six import raise_from from six.moves import urllib import attr @@ -657,9 +656,10 @@ class PerspectivesKeyFetcher(BaseV2KeyFetcher): }, ) 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: - raise_from(KeyLookupError("Remote server returned an error"), e) + raise KeyLookupError("Remote server returned an error: %s" % (e,)) keys = {} added_keys = [] @@ -821,9 +821,11 @@ class ServerKeyFetcher(BaseV2KeyFetcher): timeout=10000, ) 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: - raise_from(KeyLookupError("Remote server returned an error"), e) + raise KeyLookupError("Remote server returned an error: %s" % (e,)) if response["server_name"] != server_name: raise KeyLookupError( |