diff options
-rw-r--r-- | changelog.d/11042.bugfix | 1 | ||||
-rw-r--r-- | synapse/events/third_party_rules.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/changelog.d/11042.bugfix b/changelog.d/11042.bugfix new file mode 100644 index 0000000000..536c47417d --- /dev/null +++ b/changelog.d/11042.bugfix @@ -0,0 +1 @@ +Work around a regression, introduced in Synapse 1.39.0, that caused `SynapseError`s raised by the experimental third-party rules module callback `check_event_allowed` to be ignored. 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 |