use ok_or_else for a rare error

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-09-29 00:28:05 -04:00
parent 4413793f7e
commit b64a235165
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ impl super::Service {
let room_id: OwnedRoomId = value
.get("room_id")
.and_then(|id| RoomId::parse(id.as_str()?).ok())
.ok_or(err!(Request(InvalidParam("Invalid room id in pdu"))))?;
.ok_or_else(|| err!(Request(InvalidParam("Invalid room id in pdu"))))?;
let Ok(room_version_id) = self.services.state.get_room_version(&room_id).await else {
return Err!("Server is not in room {room_id}");