1use thiserror::Error;
4
5#[derive(Error, Debug, Clone, PartialEq)]
7pub enum CoreError {
8 #[error("Invalid dimension: expected {expected}, got {actual}")]
10 InvalidDimension { expected: usize, actual: usize },
11
12 #[error("Division by zero")]
14 DivisionByZero,
15
16 #[error("Numerical instability detected")]
18 NumericalInstability,
19
20 #[error("Invalid basis vector index: {0} (max: {1})")]
22 InvalidBasisIndex(usize, usize),
23
24 #[error("Matrix is singular and cannot be inverted")]
26 SingularMatrix,
27
28 #[error("Invalid metric signature: positive {positive} + negative {negative} + zero {zero} != dimension {dimension}")]
30 InvalidSignature {
31 positive: usize,
32 negative: usize,
33 zero: usize,
34 dimension: usize,
35 },
36}
37
38pub type CoreResult<T> = Result<T, CoreError>;