use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("This writer has already been closed")]
ClosedWriter,
#[error("There are no points added to this file")]
EmptyCopcFile,
#[error(transparent)]
LasError(#[from] las::Error),
#[error(transparent)]
LasZipError(#[from] laz::LasZipError),
#[error("The extension of the file to write does not match .copc.laz")]
WrongCopcExtension,
#[error("The requested error is not possible: {}", .0)]
InvalidResolution(f64),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("The source to be read does not contain a COPC info vlr")]
CopcInfoVlrNotFound,
#[error("The source to be read does not contain a EPT hierarchy vlr")]
EptHierarchyVlrNotFound,
#[error("laszip vlr not found")]
LasZipVlrNotFound,
#[error("The provided iterator for writing points to copc did not contain any points")]
EmptyIterator,
#[error("The point could not be added to any node in the octree")]
PointNotAddedToAnyNode,
#[error("the bounds in the passed in header is not normal: {:?}", .0)]
InvalidBounds(las::Bounds),
#[error(transparent)]
InvalidPoint(crate::PointAddError),
#[error("the set min or max sizes for point in node is invalid")]
InvalidNodeSize,
#[error(transparent)]
InvalidCrs(#[from] las_crs::CrsError),
#[error("the found epsg-code is not defined in the crs-definitions library")]
InvalidEPSGCode(u16),
}
#[derive(Error, Debug)]
pub enum PointAddError {
#[error("The point attributes of a point in the iterator don't match the header: {:?}", .0)]
PointAttributesDoNotMatch(las::point::Format),
#[error("A point in the iterator was not inside the bounds of the header")]
PointNotInBounds,
}