summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-07-01 10:52:10 +0100
committerGitHub <noreply@github.com>2022-07-01 10:52:10 +0100
commit6da861ae6937e85689825c06c9198673f5209a2b (patch)
tree137a86a0ccc97be6a2d50f32f14604a9a9a5597c
parentSkip waiting for full state for incoming events (#13144) (diff)
downloadsynapse-6da861ae6937e85689825c06c9198673f5209a2b.tar.xz
`_process_received_pdu`: Improve exception handling (#13145)
`_check_event_auth` is expected to raise `AuthError`s, so no need to log it
again.
Diffstat (limited to '')
-rw-r--r--changelog.d/13145.misc1
-rw-r--r--synapse/handlers/federation_event.py13
2 files changed, 7 insertions, 7 deletions
diff --git a/changelog.d/13145.misc b/changelog.d/13145.misc
new file mode 100644
index 0000000000..d5e2dba866
--- /dev/null
+++ b/changelog.d/13145.misc
@@ -0,0 +1 @@
+Improve exception handling when processing events received over federation.
diff --git a/synapse/handlers/federation_event.py b/synapse/handlers/federation_event.py
index b7c54e642f..479d936dc0 100644
--- a/synapse/handlers/federation_event.py
+++ b/synapse/handlers/federation_event.py
@@ -1092,20 +1092,19 @@ class FederationEventHandler:
         logger.debug("Processing event: %s", event)
         assert not event.internal_metadata.outlier
 
+        context = await self._state_handler.compute_event_context(
+            event,
+            state_ids_before_event=state_ids,
+        )
         try:
-            context = await self._state_handler.compute_event_context(
-                event,
-                state_ids_before_event=state_ids,
-            )
             context = await self._check_event_auth(
                 origin,
                 event,
                 context,
             )
         except AuthError as e:
-            # FIXME richvdh 2021/10/07 I don't think this is reachable. Let's log it
-            #   for now
-            logger.exception("Unexpected AuthError from _check_event_auth")
+            # This happens only if we couldn't find the auth events. We'll already have
+            # logged a warning, so now we just convert to a FederationError.
             raise FederationError("ERROR", e.code, e.msg, affected=event.event_id)
 
         if not backfilled and not context.rejected: