Skip to content

Commit 4494cc0

Browse files
Point out which event caused the exception when checking MSC4293 redactions (#19169)
Spawning from looking at the stack trace in #19128 which has no useful information on how to dig in deeper.
1 parent 47d24bd commit 4494cc0

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

changelog.d/19169.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Point out which event caused the exception when checking [MSC4293](https://github.com/matrix-org/matrix-spec-proposals/pull/4293) redactions.

synapse/storage/databases/main/events_worker.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,18 +1600,21 @@ def _fetch_event_rows(
16001600
if d:
16011601
d.redactions.append(redacter)
16021602

1603-
# check for MSC4932 redactions
1603+
# check for MSC4293 redactions
16041604
to_check = []
16051605
events: list[_EventRow] = []
16061606
for e in evs:
1607-
event = event_dict.get(e)
1608-
if not event:
1609-
continue
1610-
events.append(event)
1611-
event_json = json.loads(event.json)
1612-
room_id = event_json.get("room_id")
1613-
user_id = event_json.get("sender")
1614-
to_check.append((room_id, user_id))
1607+
try:
1608+
event = event_dict.get(e)
1609+
if not event:
1610+
continue
1611+
events.append(event)
1612+
event_json = json.loads(event.json)
1613+
room_id = event_json.get("room_id")
1614+
user_id = event_json.get("sender")
1615+
to_check.append((room_id, user_id))
1616+
except Exception as exc:
1617+
raise InvalidEventError(f"Invalid event {event_id}") from exc
16151618

16161619
# likely that some of these events may be for the same room/user combo, in
16171620
# which case we don't need to do redundant queries

0 commit comments

Comments
 (0)