1pub type Result<T> = std::result::Result<T, PdfError>;
5
6#[derive(Debug, thiserror::Error)]
8pub enum PdfError {
9 #[error("IO error: {0}")]
11 Io(#[from] std::io::Error),
12
13 #[error("Image error: {0}")]
15 Image(#[from] image::ImageError),
16
17 #[error("PDF error: {0}")]
19 Pdf(#[from] printpdf::Error),
20
21 #[error("No images found in folder: {0}")]
23 NoImagesFound(String),
24
25 #[error("Invalid folder path: {0}")]
27 InvalidPath(String),
28
29 #[error("{0}")]
31 Custom(String),
32}
33
34impl PdfError {
35 pub fn custom<S: Into<String>>(message: S) -> Self {
37 Self::Custom(message.into())
38 }
39}