use thiserror::Error;
#[derive(Debug, Error)]
pub enum HarmonyError {
#[error("shape mismatch: {0}")]
ShapeMismatch(String),
#[error("singular ridge system in cluster {cluster}: {reason}")]
SingularRidge { cluster: usize, reason: String },
#[error("harmony objective failed to converge in {iters} iterations")]
NotConverged { iters: usize },
#[error("invalid config: {0}")]
InvalidConfig(String),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn error_display() {
let e = HarmonyError::ShapeMismatch("z has 5 cols, labels has 3 rows".into());
assert_eq!(
e.to_string(),
"shape mismatch: z has 5 cols, labels has 3 rows"
);
}
}