mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 04:34:53 -04:00
Refactor code for turning HttpResponseException into SynapseError
This commit replaces SynapseError.from_http_response_exception with HttpResponseException.to_synapse_error. The new method actually returns a ProxiedRequestError, which allows us to pass through additional metadata from the API call.
This commit is contained in:
parent
fa7dc889f1
commit
018d75a148
3 changed files with 56 additions and 34 deletions
|
@ -506,7 +506,7 @@ class FederationClient(FederationBase):
|
|||
)
|
||||
except HttpResponseException as e:
|
||||
if not 500 <= e.code < 600:
|
||||
raise SynapseError.from_http_response_exception(e)
|
||||
raise e.to_synapse_error()
|
||||
else:
|
||||
logger.warn(
|
||||
"Failed to %s via %s: %i %s",
|
||||
|
@ -682,7 +682,7 @@ class FederationClient(FederationBase):
|
|||
)
|
||||
except HttpResponseException as e:
|
||||
if e.code == 403:
|
||||
raise SynapseError.from_http_response_exception(e)
|
||||
raise e.to_synapse_error()
|
||||
raise
|
||||
|
||||
pdu_dict = content["event"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue