fix(channels): check response status in send() for Telegram, Slack, and Discord

Reliability fix: check HTTP response status in channel send methods
This commit is contained in:
Argenis 2026-02-15 09:48:58 -05:00 committed by GitHub
parent 64a64ccd3a
commit ef00cc9a66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 5 deletions

View file

@ -376,12 +376,22 @@ impl Channel for TelegramChannel {
"parse_mode": "Markdown"
});
self.client
let resp = self
.client
.post(self.api_url("sendMessage"))
.json(&body)
.send()
.await?;
if !resp.status().is_success() {
let status = resp.status();
let err = resp
.text()
.await
.unwrap_or_else(|e| format!("<failed to read response body: {e}>"));
anyhow::bail!("Telegram sendMessage failed ({status}): {err}");
}
Ok(())
}