summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2021-10-11 16:29:02 +0100
committerGitHub <noreply@github.com>2021-10-11 16:29:02 +0100
commit3828dd819b972ed4381413c542e9e8cd43041e1b (patch)
tree635c368908b1db22070bf75244303ba25d03acc1 /synapse/events
parentRemove unnecessary list comprehension in `synapse_port_db` to fix linting in ... (diff)
downloadsynapse-3828dd819b972ed4381413c542e9e8cd43041e1b.tar.xz
Pass through `SynapseError`s that are raised from experimental `check_event_allowed` callback of the module API (#11042)
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/third_party_rules.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/events/third_party_rules.py b/synapse/events/third_party_rules.py
index d94b1bb4d2..976d9fa446 100644
--- a/synapse/events/third_party_rules.py
+++ b/synapse/events/third_party_rules.py
@@ -217,6 +217,15 @@ class ThirdPartyEventRules:
         for callback in self._check_event_allowed_callbacks:
             try:
                 res, replacement_data = await callback(event, state_events)
+            except SynapseError as e:
+                # FIXME: Being able to throw SynapseErrors is relied upon by
+                # some modules. PR #10386 accidentally broke this ability.
+                # That said, we aren't keen on exposing this implementation detail
+                # to modules and we should one day have a proper way to do what
+                # is wanted.
+                # This module callback needs a rework so that hacks such as
+                # this one are not necessary.
+                raise e
             except Exception as e:
                 logger.warning("Failed to run module API callback %s: %s", callback, e)
                 continue