`_process_received_pdu`: Improve exception handling (#13145)
`_check_event_auth` is expected to raise `AuthError`s, so no need to log it again.
This commit is contained in:
parent
8c2825276f
commit
6da861ae69
|
@ -0,0 +1 @@
|
||||||
|
Improve exception handling when processing events received over federation.
|
|
@ -1092,20 +1092,19 @@ class FederationEventHandler:
|
||||||
logger.debug("Processing event: %s", event)
|
logger.debug("Processing event: %s", event)
|
||||||
assert not event.internal_metadata.outlier
|
assert not event.internal_metadata.outlier
|
||||||
|
|
||||||
try:
|
|
||||||
context = await self._state_handler.compute_event_context(
|
context = await self._state_handler.compute_event_context(
|
||||||
event,
|
event,
|
||||||
state_ids_before_event=state_ids,
|
state_ids_before_event=state_ids,
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
context = await self._check_event_auth(
|
context = await self._check_event_auth(
|
||||||
origin,
|
origin,
|
||||||
event,
|
event,
|
||||||
context,
|
context,
|
||||||
)
|
)
|
||||||
except AuthError as e:
|
except AuthError as e:
|
||||||
# FIXME richvdh 2021/10/07 I don't think this is reachable. Let's log it
|
# This happens only if we couldn't find the auth events. We'll already have
|
||||||
# for now
|
# logged a warning, so now we just convert to a FederationError.
|
||||||
logger.exception("Unexpected AuthError from _check_event_auth")
|
|
||||||
raise FederationError("ERROR", e.code, e.msg, affected=event.event_id)
|
raise FederationError("ERROR", e.code, e.msg, affected=event.event_id)
|
||||||
|
|
||||||
if not backfilled and not context.rejected:
|
if not backfilled and not context.rejected:
|
||||||
|
|
Loading…
Reference in New Issue