config: Rework error handling into explicit error types

This commit is contained in:
2025-05-15 19:09:41 +00:00
parent e79dfe9fc5
commit e771639856
2 changed files with 27 additions and 7 deletions

View File

@ -46,7 +46,9 @@ use chrono::DateTime;
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();
let config = Config::load("bots.yaml").expect("Failed to load config");
let config = Config::load("bots.yaml").unwrap_or_else(|e| {
panic!("Failed to load config: {e:?}")
});
let config = Arc::new(config);
// This message passing channel is used for sending messages to the matrix module,
@ -109,7 +111,7 @@ async fn main() -> anyhow::Result<()> {
if parsed.ts > state_ts {
info!("Entry {} has not been posted yet, sending to matrix", entry.id);
let msg = parsed.formatted.unwrap();
let msg = parsed.formatted.unwrap(); // XXX
bcast_tx.send((msg, rooms.clone())).unwrap();
max_ts = max(max_ts, parsed.ts);