leverage snafu for better scanning error messages
This commit is contained in:
parent
14fb489f49
commit
01094e3219
1 changed files with 5 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use std::{fs::File, io, path::PathBuf};
|
use std::{fs::File, io, path::PathBuf};
|
||||||
|
|
||||||
use snafu::{ResultExt, Snafu};
|
use snafu::{Report, ResultExt, Snafu};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -27,11 +27,13 @@ pub async fn scan(
|
||||||
match book_result {
|
match book_result {
|
||||||
Ok(book) => {
|
Ok(book) => {
|
||||||
if let Err(e) = process_book(&book, db, tokenizer, text_encoder, chunk_size).await {
|
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) => {
|
Err(e) => {
|
||||||
error!("error fetching calibre book: {e}");
|
let error = Report::from_error(e);
|
||||||
|
error!("error fetching calibre book: {}", error.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue