handle db errors properly

This commit is contained in:
yggverse 2026-04-06 23:44:28 +03:00
parent b676060798
commit 28b614d5db

View file

@ -44,13 +44,21 @@ async fn main() {
let items = result.content.items;
debug!("received {:?} items to handle...", items.len());
for item in items {
if database.get(&item.id).is_ok_and(|r| r.is_some()) {
match database.get(&item.id) {
Ok(id) => {
if id.is_some() {
debug!(
"item `{}` for channel `{c}` already processed; skip handle.",
item.id
);
continue;
}
}
Err(e) => panic!(
"can't check item `{}` in DB for channel `{c}`: {e}",
item.id
),
}
if item.is_live != channel.is_live {
debug!(
"skip item `{}` for channel `{c}` by `is_live` filter (item: {:?}/config:{:?})",
@ -85,7 +93,7 @@ async fn main() {
"exec `{cmd}` for channel `{c}` successful: `{:?}`",
response
),
Err(e) => error!(
Err(e) => panic!(
"can't persist processed item `{}` for channel `{c}` by `{cmd}`: `{e}`",
item.id
),