pdfrum_doc/error.rs
1//! What can go wrong at this level.
2//!
3//! Very little can. Nearly every reader here is damage-tolerant by design —
4//! a missing key, a mistyped value or a broken tree yields an absent or empty
5//! answer plus a diagnostic, never an error — so this enum covers only the
6//! two cases where a caller genuinely cannot proceed.
7
8use pdfrum_object::ObjRef;
9
10/// A failure that stops a document-level operation.
11#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
12#[non_exhaustive]
13pub enum Error {
14 /// The document has no catalog, so there is nothing to read from.
15 #[error("the document has no catalog")]
16 NoCatalog,
17 /// An indirect object a walk depends on could not be fetched.
18 #[error("object {0:?} could not be resolved")]
19 Unresolved(ObjRef),
20}