use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("cell dimensions must be positive and finite, got x={x}, y={y}")]
InvalidCellSize {
x: f64,
y: f64,
},
#[error("observer position ({row}, {col}) is outside grid of size ({height}, {width})")]
ObserverOutOfBounds {
row: usize,
col: usize,
height: usize,
width: usize,
},
#[error("viewshed max_distance must be positive and finite, or infinity, got {0}")]
InvalidViewshedMaxDistance(f64),
#[error("contour interval must be positive and finite, got {0}")]
InvalidContourInterval(f64),
#[error("grid shapes must match: {left} has shape {left_shape:?}, {right} has shape {right_shape:?}")]
ShapeMismatch {
left: &'static str,
left_shape: (usize, usize),
right: &'static str,
right_shape: (usize, usize),
},
#[error("pour point ({row}, {col}) is outside grid of size ({height}, {width})")]
PourPointOutOfBounds {
row: usize,
col: usize,
height: usize,
width: usize,
},
}
pub type Result<T> = std::result::Result<T, Error>;