From 9af812a3e71c1142ef306d68ba6ba8a27483686a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 23 Mar 2024 22:17:48 +0000 Subject: [PATCH] refactor(jsonrpc): add msg_id and account_id to get_message() errors --- deltachat-jsonrpc/src/api.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deltachat-jsonrpc/src/api.rs b/deltachat-jsonrpc/src/api.rs index f9dfca46f..859c62715 100644 --- a/deltachat-jsonrpc/src/api.rs +++ b/deltachat-jsonrpc/src/api.rs @@ -1097,9 +1097,12 @@ impl CommandApi { .collect::>()) } - async fn get_message(&self, account_id: u32, message_id: u32) -> Result { + async fn get_message(&self, account_id: u32, msg_id: u32) -> Result { let ctx = self.get_context(account_id).await?; - MessageObject::from_msg_id(&ctx, MsgId::new(message_id)).await + let msg_id = MsgId::new(msg_id); + MessageObject::from_msg_id(&ctx, msg_id) + .await + .with_context(|| format!("Failed to load message {msg_id} for account {account_id}")) } async fn get_message_html(&self, account_id: u32, message_id: u32) -> Result> {