use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("PDF error: {0}")]
Pdf(#[from] lopdf::Error),
#[error("unsupported font kind: only TrueType (.ttf) and OpenType (.otf) are supported")]
UnsupportedFontKind,
#[error("font parse error: {0}")]
FontParse(String),
#[error("page {0} not found")]
PageNotFound(u32),
#[error("font handle {0} is invalid")]
InvalidFont(u32),
#[cfg(feature = "image")]
#[error("image decode error: {0}")]
ImageDecode(String),
#[error("invalid input: {0}")]
InvalidInput(String),
}
pub type Result<T> = std::result::Result<T, Error>;