diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 493938a9..11f1d701 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -814,8 +814,10 @@ impl Service { } // Hash and sign - let mut pdu_json = - utils::to_canonical_object(&pdu).expect("event is valid, we just created it"); + let mut pdu_json = utils::to_canonical_object(&pdu).map_err(|e| { + error!("Failed to convert PDU {:?} to canonical JSON: {}", &pdu, e); + Error::bad_database("Failed to convert PDU to canonical JSON.") + })?; pdu_json.remove("event_id");