1pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug, thiserror::Error)]
11pub enum Error {
12 #[error("i/o error: {0}")]
13 Io(#[from] std::io::Error),
14 #[error("syntax error at byte {offset}: {msg}")]
15 Syntax { offset: usize, msg: String },
16 #[error("invalid or unrecoverable cross-reference data")]
17 InvalidXref,
18 #[error("object {0} {1} not found")]
19 ObjectNotFound(u32, u16),
20 #[error("missing required key /{0}")]
21 MissingKey(&'static str),
22 #[error("type mismatch: expected {expected}, found {found}")]
23 TypeMismatch {
24 expected: &'static str,
25 found: &'static str,
26 },
27 #[error("unsupported filter /{0}")]
28 UnsupportedFilter(String),
29 #[error("stream decode failed: {0}")]
30 Decode(String),
31 #[error("encrypted documents are not supported")]
32 Encrypted,
33 #[error("page index {0} out of bounds ({1} pages)")]
34 PageNotFound(usize, usize),
35 #[error("circular reference involving object {0}")]
36 CircularReference(u32),
37 #[error("transport: {0}")]
47 Transport(String),
48 #[error("{0}")]
49 Other(String),
50}