pdf2image_alt/
error.rs

1use thiserror::Error;
2
3/// A `Result` type alias using `PDF2ImgError` instances as the error variant.
4pub type Result<T> = std::result::Result<T, PDF2ImageError>;
5
6/// pdf2img error variants
7#[derive(Error, Debug)]
8pub enum PDF2ImageError {
9    /// An I/O error.
10    #[error("i/o error: {0}")]
11    Io(#[from] std::io::Error),
12    /// A UTF-8 parsing error.
13    #[error("utf-8 parsing error: {0}")]
14    Utf8(#[from] std::str::Utf8Error),
15    /// An integer parsing error.
16    #[error("int parsing error: {0}")]
17    ParseInt(#[from] std::num::ParseIntError),
18    /// An image error.
19    #[error("image error: {0}")]
20    ImageError(#[from] image::ImageError),
21    /// An error indicating that the builder is misconfigured.
22    #[error("RenderOptionsBuilder error: {0}")]
23    RenderOptionsBuilder(#[from] crate::render_options::RenderOptionsBuilderError),
24    /// An error indicating that the PDF is encrypted and no password was provided.
25    #[error("No password given for encrypted PDF")]
26    NoPasswordForEncryptedPDF,
27    #[error("unable to extract page count")]
28    UnableToExtractPageCount,
29    #[error("unable to extract encryption status")]
30    UnableToExtractEncryptionStatus,
31}