feat: add context to message loading failures

This commit is contained in:
link2xt
2026-02-20 20:48:54 +00:00
parent e95dca87bd
commit f055f6226c
2 changed files with 11 additions and 3 deletions

View File

@@ -887,7 +887,11 @@ UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1
.is_some()
{
can_info_msg = false;
Some(Message::load_from_db(context, insert_msg_id).await?)
Some(
Message::load_from_db(context, insert_msg_id)
.await
.context("Failed to load just created webxdc instance")?,
)
} else if let Some(field) = mime_parser.get_header(HeaderDef::InReplyTo) {
if let Some(instance) =
message::get_by_rfc724_mids(context, &parse_message_ids(field)).await?
@@ -2137,7 +2141,9 @@ async fn add_parts(
}
if let Some(replace_msg_id) = replace_msg_id {
let placeholder = Message::load_from_db(context, replace_msg_id).await?;
let placeholder = Message::load_from_db(context, replace_msg_id)
.await
.context("Failed to load placeholder message")?;
for key in [
Param::WebxdcSummary,
Param::WebxdcSummaryTimestamp,

View File

@@ -389,7 +389,9 @@ impl Context {
}
if let Some(ref href) = status_update_item.href {
let mut notify_msg = Message::load_from_db(self, notify_msg_id).await?;
let mut notify_msg = Message::load_from_db(self, notify_msg_id)
.await
.context("Failed to load just created notification message")?;
notify_msg.param.set(Param::Arg, href);
notify_msg.update_param(self).await?;
}