feat: Better logging for failing securejoin messages (#7593)

This will make bugs like https://github.com/chatmail/core/issues/7478
easier to debug (even though we may be able to fix #7478 without waiting
for more logs)
This commit is contained in:
Hocuri
2025-12-10 23:08:37 +01:00
committed by GitHub
parent 58cd133b5c
commit e432960246

View File

@@ -677,12 +677,22 @@ pub(crate) async fn receive_imf_inner(
let res = if mime_parser.incoming {
handle_securejoin_handshake(context, &mut mime_parser, from_id)
.await
.context("error in Secure-Join message handling")?
.with_context(|| {
format!(
"Error in Secure-Join '{}' message handling",
mime_parser.get_header(HeaderDef::SecureJoin).unwrap_or("")
)
})?
} else if let Some(to_id) = to_ids.first().copied().flatten() {
// handshake may mark contacts as verified and must be processed before chats are created
observe_securejoin_on_other_device(context, &mime_parser, to_id)
.await
.context("error in Secure-Join watching")?
.with_context(|| {
format!(
"Error in Secure-Join '{}' watching",
mime_parser.get_header(HeaderDef::SecureJoin).unwrap_or("")
)
})?
} else {
securejoin::HandshakeMessage::Propagate
};