fix(telegram): log specific deleteMessage failure reason in finalize_draft

Split the catch-all `_` match arm on the deleteMessage result into
separate `Ok(r)` and `Err(e)` arms so that HTTP status codes and
network errors are logged individually. The response body is not
logged (security policy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
cyberpapi 2026-02-24 16:14:15 -05:00 committed by Chum Yin
parent b2fc063d88
commit 9125651775

View File

@ -2956,11 +2956,16 @@ impl Channel for TelegramChannel {
self.send_text_chunks(text, &chat_id, thread_id.as_deref())
.await
}
_ => {
// Delete failed — draft still visible with content from update_draft.
// Sending a new message now would create a duplicate, so skip it.
Ok(r) => {
let status = r.status();
tracing::warn!(
"Telegram deleteMessage failed; draft still shows response, skipping sendMessage to avoid duplicate"
"Telegram deleteMessage failed ({status}); draft still shows response, skipping sendMessage to avoid duplicate"
);
Ok(())
}
Err(e) => {
tracing::warn!(
"Telegram deleteMessage network error: {e}; draft still shows response, skipping sendMessage to avoid duplicate"
);
Ok(())
}