processors_rs/pdf/tesseract/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug, PartialEq)]
4pub enum TessError {
5    #[error("Tesseract not found. Please check installation path!")]
6    TesseractNotFoundError,
7
8    #[error("Command ExitStatusError\n{0}")]
9    CommandExitStatusError(String, String),
10
11    #[error(
12        "Image format not within the list of allowed image formats:\n\
13        ['JPEG','JPG','PNG','PBM','PGM','PPM','TIFF','BMP','GIF','WEBP']"
14    )]
15    ImageFormatError,
16
17    #[error("Please assign a valid image path.")]
18    ImageNotFoundError,
19
20    #[error("Could not parse {0}.")]
21    ParseError(String),
22
23    #[error("Could not create tempfile.\n{0}")]
24    TempfileError(String),
25
26    #[error("Could not save dynamic image to tempfile.\n{0}")]
27    DynamicImageError(String),
28}
29
30pub type TessResult<T> = Result<T, TessError>;