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

Pass through SynapseErrors that are raised from experimental check_event_allowed callback of the module API #11042

Merged
merged 4 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11042.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Work around a regression, introduced in Synapse 1.39.0, that caused `SynapseError`s raised by the experimental Module API callback `check_event_allowed` to be ignored.
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions synapse/events/third_party_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ async def check_event_allowed(
for callback in self._check_event_allowed_callbacks:
try:
res, replacement_data = await callback(event, state_events)
except SynapseError as e:
# HACK. Being able to throw SynapseErrors is relied upon by
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
# 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 API callback needs a rework so that hacks such as
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
# this one are not necessary.
raise e
except Exception as e:
logger.warning("Failed to run module API callback %s: %s", callback, e)
continue
Expand Down