Skip to main content

copc_streaming/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur when reading a COPC file.
4#[derive(Debug, Error)]
5pub enum CopcError {
6    /// I/O error from the underlying byte source.
7    #[error("I/O error: {0}")]
8    Io(#[from] std::io::Error),
9
10    /// Error parsing LAS header or VLR data.
11    #[error("LAS error: {0}")]
12    Las(#[from] las::Error),
13
14    /// Error during LAZ decompression.
15    #[error("LAZ error: {0}")]
16    Laz(#[from] laz::LasZipError),
17
18    /// The required COPC info VLR was not found.
19    #[error("COPC info VLR not found")]
20    CopcInfoNotFound,
21
22    /// The required LAZ VLR was not found.
23    #[error("LAZ VLR not found")]
24    LazVlrNotFound,
25
26    /// A hierarchy page was shorter than expected.
27    #[error("hierarchy page at offset {offset} truncated")]
28    TruncatedHierarchyPage {
29        /// File offset where the truncated page starts.
30        offset: u64,
31    },
32
33    /// The requested node is not in the loaded hierarchy.
34    #[error("node not found in hierarchy: {0:?}")]
35    NodeNotFound(crate::types::VoxelKey),
36
37    /// Custom error from a [`ByteSource`](crate::ByteSource) implementation.
38    #[error("byte source error: {0}")]
39    ByteSource(Box<dyn std::error::Error + Send + Sync>),
40}