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

Commit

Permalink
Pass through SynapseErrors that are raised from experimental `check…
Browse files Browse the repository at this point in the history
…_event_allowed` callback of the module API (#11042)

Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
  • Loading branch information
reivilibre and babolivier authored Oct 11, 2021
1 parent 4c83811 commit 3828dd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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 third-party rules module callback `check_event_allowed` to be ignored.
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:
# 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
Expand Down

0 comments on commit 3828dd8

Please sign in to comment.