Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 3828dd8

Browse files
Pass through SynapseErrors that are raised from experimental check_event_allowed callback of the module API (#11042)
Co-authored-by: Brendan Abolivier <[email protected]>
1 parent 4c83811 commit 3828dd8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

changelog.d/11042.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

synapse/events/third_party_rules.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ async def check_event_allowed(
217217
for callback in self._check_event_allowed_callbacks:
218218
try:
219219
res, replacement_data = await callback(event, state_events)
220+
except SynapseError as e:
221+
# FIXME: Being able to throw SynapseErrors is relied upon by
222+
# some modules. PR #10386 accidentally broke this ability.
223+
# That said, we aren't keen on exposing this implementation detail
224+
# to modules and we should one day have a proper way to do what
225+
# is wanted.
226+
# This module callback needs a rework so that hacks such as
227+
# this one are not necessary.
228+
raise e
220229
except Exception as e:
221230
logger.warning("Failed to run module API callback %s: %s", callback, e)
222231
continue

0 commit comments

Comments
 (0)