Skip to main content

lopdf_table/
error.rs

1//! Error types for the lopdf-table library
2
3use thiserror::Error;
4
5/// Result type alias using TableError
6pub type Result<T> = std::result::Result<T, TableError>;
7
8/// Errors that can occur when working with tables
9#[derive(Debug, Error)]
10pub enum TableError {
11    /// Error from the underlying lopdf library
12    #[error("PDF operation failed: {0}")]
13    PdfError(#[from] lopdf::Error),
14
15    /// Invalid table structure
16    #[error("Invalid table structure: {0}")]
17    InvalidTable(String),
18
19    /// Layout calculation error
20    #[error("Layout calculation failed: {0}")]
21    LayoutError(String),
22
23    /// Invalid styling configuration
24    #[error("Invalid style configuration: {0}")]
25    StyleError(String),
26
27    /// Text rendering error
28    #[error("Text rendering failed: {0}")]
29    TextError(String),
30
31    /// Invalid dimensions
32    #[error("Invalid dimensions: {0}")]
33    DimensionError(String),
34
35    /// Page not found
36    #[error("Page with ID {0:?} not found")]
37    PageNotFound(lopdf::ObjectId),
38
39    /// Drawing operation error
40    #[error("Drawing operation failed: {0}")]
41    DrawingError(String),
42}