refactor: return the reason when failing to place calls

This commit is contained in:
link2xt
2025-10-03 17:04:19 +00:00
committed by l
parent bfc08abe88
commit 9d39769445

View File

@@ -183,7 +183,11 @@ impl Context {
place_call_info: String,
) -> Result<MsgId> {
let chat = Chat::load_from_db(self, chat_id).await?;
ensure!(chat.typ == Chattype::Single && !chat.is_self_talk());
ensure!(
chat.typ == Chattype::Single,
"Can only place calls in 1:1 chats"
);
ensure!(!chat.is_self_talk(), "Cannot call self");
let mut call = Message {
viewtype: Viewtype::Call,