diff --git a/Cargo.lock b/Cargo.lock index de1571b..5ec5dba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1558,6 +1558,7 @@ dependencies = [ "derive_builder", "directories", "epub-builder", + "eyre", "flexi_logger", "futures", "html5ever", @@ -2504,9 +2505,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" diff --git a/Cargo.toml b/Cargo.toml index be5eba6..65a8dec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ comfy-table = "3.0.0" derive_builder = "0.20.0" directories = "5.0.1" epub-builder = "0.7.4" +eyre = "0.6" flexi_logger = "0.27.4" futures = "0.3.30" html5ever = "0.25.1" diff --git a/src/epub.rs b/src/epub.rs index d589ff4..14239a3 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -249,10 +249,7 @@ fn replace_escaped_characters(value: &str) -> String { .replace(">", ">") } -fn add_stylesheets( - epub: &mut EpubBuilder, - app_config: &AppConfig, -) -> Result<(), epub_builder::Error> { +fn add_stylesheets(epub: &mut EpubBuilder, app_config: &AppConfig) -> eyre::Result<()> { let body_stylesheet: &[u8] = include_bytes!("./assets/body.min.css"); let header_stylesheet: &[u8] = include_bytes!("./assets/headers.min.css"); match app_config.css_config { diff --git a/src/errors.rs b/src/errors.rs index c615477..7df872a 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -98,9 +98,9 @@ impl From for PaperoniError { } } -impl From for PaperoniError { - fn from(err: epub_builder::Error) -> Self { - PaperoniError::with_kind(ErrorKind::EpubError(err.description().to_owned())) +impl From for PaperoniError { + fn from(err: eyre::Error) -> Self { + PaperoniError::with_kind(ErrorKind::EpubError(err.to_string())) } }