1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Error, Debug)]
8pub enum Error {
9 #[error("This writer has already been closed")]
11 ClosedWriter,
12
13 #[error("There are no points added to this file")]
15 EmptyCopcFile,
16
17 #[error(transparent)]
19 LasError(#[from] las::Error),
20
21 #[error(transparent)]
23 LasZipError(#[from] laz::LasZipError),
24
25 #[error("The extension of the file to write does not match .copc.laz")]
27 WrongCopcExtension,
28
29 #[error("The requested error is not possible: {}", .0)]
31 InvalidResolution(f64),
32
33 #[error(transparent)]
35 Io(#[from] std::io::Error),
36
37 #[error("The source to be read does not contain a COPC info vlr")]
39 CopcInfoVlrNotFound,
40
41 #[error("The source to be read does not contain a EPT hierarchy vlr")]
43 EptHierarchyVlrNotFound,
44
45 #[error("laszip vlr not found")]
47 LasZipVlrNotFound,
48
49 #[error("The provided iterator for writing points to copc did not contain any points")]
51 EmptyIterator,
52
53 #[error("The point could not be added to any node in the octree")]
55 PointNotAddedToAnyNode,
56
57 #[error("the bounds in the passed in header is not normal: {:?}", .0)]
59 InvalidBounds(las::Bounds),
60
61 #[error(transparent)]
63 InvalidPoint(crate::PointAddError),
64
65 #[error("the set min or max sizes for point in node is invalid")]
67 InvalidNodeSize,
68
69 #[error(transparent)]
71 InvalidCrs(#[from] las_crs::CrsError),
72
73 #[error("the found epsg-code is not defined in the crs-definitions library")]
75 InvalidEPSGCode(u16),
76}
77
78#[derive(Error, Debug)]
80pub enum PointAddError {
81 #[error("The point attributes of a point in the iterator don't match the header: {:?}", .0)]
87 PointAttributesDoNotMatch(las::point::Format),
88
89 #[error("A point in the iterator was not inside the bounds of the header")]
95 PointNotInBounds,
96}