From e432960246b1cd3dae04ee36855a7df1ae4563b2 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Wed, 10 Dec 2025 23:08:37 +0100 Subject: [PATCH] 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) --- src/receive_imf.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 248365292..0013443fc 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -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 };