From 9d7f7b871b9783dbdce15e0491b0eaa9d948b21f Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Sat, 23 Dec 2023 21:00:00 -0800 Subject: [PATCH] don't panic on missing presence status for a user --- src/api/client_server/presence.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/api/client_server/presence.rs b/src/api/client_server/presence.rs index ef88d1a0..e5cd1b8e 100644 --- a/src/api/client_server/presence.rs +++ b/src/api/client_server/presence.rs @@ -1,5 +1,8 @@ -use crate::{services, utils, Result, Ruma}; -use ruma::api::client::presence::{get_presence, set_presence}; +use crate::{services, utils, Error, Result, Ruma}; +use ruma::api::client::{ + error::ErrorKind, + presence::{get_presence, set_presence}, +}; use std::time::Duration; /// # `PUT /_matrix/client/r0/presence/{userId}/status` @@ -79,6 +82,9 @@ pub async fn get_presence_route( presence: presence.content.presence, }) } else { - todo!(); + Err(Error::BadRequest( + ErrorKind::NotFound, + "Presence state for this user was not found", + )) } }