oxigdal_copc/error.rs
1//! Error types for oxigdal-copc
2
3use thiserror::Error;
4
5/// Errors that can occur when parsing COPC / LAS files.
6#[derive(Debug, Error)]
7pub enum CopcError {
8 /// The binary data does not conform to the expected format.
9 #[error("Invalid format: {0}")]
10 InvalidFormat(String),
11
12 /// Unsupported LAS version encountered.
13 #[error("Unsupported LAS version: {0}.{1}")]
14 UnsupportedVersion(u8, u8),
15
16 /// An I/O error occurred.
17 #[error("IO error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// A LAZ point format that this crate cannot yet decompress was requested.
21 ///
22 /// Slice 24 W3 ships PF0 and PF1 only. PF6/7/8 (the COPC mandate) are
23 /// deferred to a follow-up slice; until then, this variant flags them so
24 /// callers can fail gracefully instead of producing garbage points.
25 #[error("Unsupported LAZ point format: {format_id} (only formats 0 and 1 are supported)")]
26 UnsupportedLazFormat {
27 /// LAS point data record format ID (0-10) that is not yet supported.
28 format_id: u8,
29 },
30
31 /// An internal LASzip decoder invariant was violated (malformed compressed stream).
32 #[error("LAZ decoder error: {0}")]
33 LazDecoderError(String),
34}