Overview
| Comment: | fix error formatting |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | v0.4.3 |
| Files: | files | file ages | folders |
| SHA3-256: |
5a4aab7687ee6334e372512e1950bbb6 |
| User & Date: | arcade on 2025-06-29 19:04:20.177 |
| Other Links: | manifest | tags |
Context
|
2025-07-01
| ||
| 11:13 | tweak logging, simplify connection objects, use async_std primitives check-in: c6d3e97290 user: arcade tags: trunk, v0.4.4 | |
|
2025-06-29
| ||
| 19:04 | fix error formatting check-in: 5a4aab7687 user: arcade tags: trunk, v0.4.3 | |
| 17:30 | add more details on errors check-in: b4af85e31b user: arcade tags: trunk, v0.4.2 | |
Changes
Modified Cargo.lock
from [1993bbc09e]
to [5165f92f08].
| ︙ | ︙ | |||
2096 2097 2098 2099 2100 2101 2102 | "derive_builder", "never", "quick-xml", ] [[package]] name = "rsstg" | | | 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 | "derive_builder", "never", "quick-xml", ] [[package]] name = "rsstg" version = "0.4.3" dependencies = [ "anyhow", "async-std", "atom_syndication", "chrono", "config", "futures", |
| ︙ | ︙ |
Modified Cargo.toml
from [f63b30eaa6]
to [3b85882dc8].
1 2 | [package] name = "rsstg" | | | 1 2 3 4 5 6 7 8 9 10 |
[package]
name = "rsstg"
version = "0.4.3"
authors = ["arcade"]
edition = "2021"
[dependencies]
anyhow = "1.0.86"
async-std = { version = "1.12.0", features = [ "attributes", "tokio1" ] }
atom_syndication = { version = "0.12.4", features = [ "with-serde" ] }
|
| ︙ | ︙ |
Modified src/core.rs
from [a6ef31f33f]
to [28430d049a].
| ︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
use anyhow::{
anyhow,
bail,
Result,
};
use async_std::task;
use chrono::DateTime;
use tgbot::{
api::Client,
handler::UpdateHandler,
types::{
Bot,
ChatPeerId,
Command,
GetBot,
Message,
ParseMode,
SendMessage,
Update,
UpdateType,
UserPeerId,
},
};
#[derive(Clone)]
pub struct Core {
owner_chat: ChatPeerId,
// max_delay: u16,
pub tg: Client,
pub me: Bot,
| > > > > > > > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
use anyhow::{
anyhow,
bail,
Result,
};
use async_std::task;
use chrono::DateTime;
use lazy_static::lazy_static;
use regex::Regex;
use tgbot::{
api::Client,
handler::UpdateHandler,
types::{
Bot,
ChatPeerId,
Command,
GetBot,
Message,
ParseMode,
SendMessage,
Update,
UpdateType,
UserPeerId,
},
};
lazy_static!{
pub static ref RE_SPECIAL: Regex = Regex::new(r"([\-_*\[\]()~`>#+|{}\.!])").unwrap();
}
/// Encodes special HTML entities to prevent them interfering with Telegram HTML
pub fn encode (text: &str) -> Cow<'_, str> {
RE_SPECIAL.replace_all(text, "\\$1")
}
#[derive(Clone)]
pub struct Core {
owner_chat: ChatPeerId,
// max_delay: u16,
pub tg: Client,
pub me: Bot,
|
| ︙ | ︙ | |||
208 209 210 211 212 213 214 |
Ok(Some(source)) => source.to_string(),
Ok(None) => "Source not found in database?".to_string(),
Err(err) => format!("Failed to fetch source data:\n{err}"),
}
};
task::spawn(async move {
if let Err(err) = clone.check(source_id, true).await {
| | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
Ok(Some(source)) => source.to_string(),
Ok(None) => "Source not found in database?".to_string(),
Err(err) => format!("Failed to fetch source data:\n{err}"),
}
};
task::spawn(async move {
if let Err(err) = clone.check(source_id, true).await {
if let Err(err) = clone.send(&format!("{source}\nš {}", encode(&err.to_string())), None, Some(ParseMode::MarkdownV2)).await {
eprintln!("Check error: {err:?}");
// clone.disable(&source_id, owner).await.unwrap();
};
};
});
}
} else if next_fetch - now < delay {
|
| ︙ | ︙ |