leverage snafu for better scanning error messages

This commit is contained in:
Sebastian Hugentobler 2025-07-08 13:36:52 +02:00
parent 14fb489f49
commit 01094e3219
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M

View file

@ -2,7 +2,7 @@
use std::{fs::File, io, path::PathBuf};
use snafu::{ResultExt, Snafu};
use snafu::{Report, ResultExt, Snafu};
use tracing::{error, info};
use crate::{
@ -27,11 +27,13 @@ pub async fn scan(
match book_result {
Ok(book) => {
if let Err(e) = process_book(&book, db, tokenizer, text_encoder, chunk_size).await {
error!("Failed to process book {}: {e}", book.id);
let error = Report::from_error(e);
error!("Failed to process book {}: {}", book.id, error.to_string());
}
}
Err(e) => {
error!("error fetching calibre book: {e}");
let error = Report::from_error(e);
error!("error fetching calibre book: {}", error.to_string());
}
}
}