eindir_core/error.rs
1use thiserror::Error;
2
3/// Error type returned by all fallible operations in `eindir-core`.
4#[derive(Debug, Error)]
5pub enum Error {
6 /// Returned when an input array's shape disagrees with the expected dimensionality.
7 #[error("dimension mismatch: expected {expected}, got {got}")]
8 DimensionMismatch {
9 /// Expected dimensionality, in number of elements along the first axis.
10 expected: usize,
11 /// Observed dimensionality.
12 got: usize,
13 },
14 /// Returned when an index, parameter, or value lies outside its valid range.
15 #[error("out of bounds: {0}")]
16 OutOfBounds(String),
17}