1use scirs2_core::error::CoreError;
4use scirs2_linalg::error::LinalgError;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
9pub enum ClusteringError {
10 #[error("Invalid input: {0}")]
12 InvalidInput(String),
13
14 #[error("Computation error: {0}")]
16 ComputationError(String),
17
18 #[error("Vector quantization error: {0}")]
20 VqError(String),
21
22 #[error("Hierarchical clustering error: {0}")]
24 HierarchyError(String),
25
26 #[error("Empty cluster error: {0}")]
28 EmptyCluster(String),
29
30 #[error("Invalid state: {0}")]
32 InvalidState(String),
33
34 #[error("Linear algebra error: {0}")]
36 LinalgError(#[from] LinalgError),
37
38 #[error("Core validation error: {0}")]
40 CoreError(#[from] CoreError),
41
42 #[error("I/O error: {0}")]
44 IoError(#[from] std::io::Error),
45
46 #[error("JSON error: {0}")]
48 JsonError(#[from] serde_json::Error),
49
50 #[error("Error: {0}")]
52 Other(String),
53}
54
55pub type Result<T> = std::result::Result<T, ClusteringError>;