1use thiserror::Error as ThisError;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, ThisError)]
6pub enum Error {
7 #[error("invalid COPC input: {0}")]
8 InvalidInput(String),
9 #[error("invalid COPC data: {0}")]
10 InvalidData(String),
11 #[error("LAS/LAZ error: {0}")]
12 Las(String),
13 #[error("{context}: {source}")]
14 Io {
15 context: &'static str,
16 #[source]
17 source: std::io::Error,
18 },
19 #[error("operation cancelled")]
20 Cancelled,
21 #[error("unsupported COPC feature: {0}")]
22 Unsupported(String),
23}
24
25impl Error {
26 pub fn io(context: &'static str, source: std::io::Error) -> Self {
27 Self::Io { context, source }
28 }
29}