fix: error handling

This commit is contained in:
Timo Kösters 2022-01-18 17:24:34 +01:00
parent d655f4c1be
commit 686319e2e3
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4

View file

@ -342,7 +342,7 @@ pub(crate) fn gen_event_id_canonical_json(
let room_id = value
.get("room_id")
.and_then(|id| RoomId::parse(id.as_str()?).ok())
.expect("Invalid room id in event");
.ok_or_else(|| Error::bad_database("PDU in db has invalid room_id."))?;
let room_version_id = db.rooms.get_room_version(&room_id);