1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum MetricsError {
8 #[error("Invalid input: {0}")]
10 InvalidInput(String),
11
12 #[error("Calculation error: {0}")]
14 CalculationError(String),
15
16 #[error("Computation error: {0}")]
18 ComputationError(String),
19
20 #[error("Dimension mismatch: {0}")]
22 DimensionMismatch(String),
23
24 #[error("Shape mismatch: shape1 = {shape1}, shape2 = {shape2}")]
26 ShapeMismatch {
27 shape1: String,
29 shape2: String,
31 },
32
33 #[error("Invalid argument: {0}")]
35 InvalidArgument(String),
36
37 #[error("Division by zero")]
39 DivisionByZero,
40
41 #[error("Statistics error: {0}")]
43 StatsError(String),
44
45 #[error("Linear algebra error: {0}")]
47 LinalgError(String),
48
49 #[error("IO error: {0}")]
51 IOError(String),
52
53 #[error("Serialization error: {0}")]
55 SerializationError(String),
56
57 #[error("Deserialization error: {0}")]
59 DeserializationError(String),
60
61 #[error("Visualization error: {0}")]
63 VisualizationError(String),
64
65 #[error("Memory error: {0}")]
67 MemoryError(String),
68
69 #[error("Index error: {0}")]
71 IndexError(String),
72
73 #[error("Core error: {0}")]
75 CoreError(#[from] scirs2_core::error::CoreError),
76
77 #[error("Consensus error: {0}")]
79 ConsensusError(String),
80
81 #[error("Sharding error: {0}")]
83 ShardingError(String),
84
85 #[error("Fault tolerance error: {0}")]
87 FaultToleranceError(String),
88
89 #[error("Invalid operation: {0}")]
91 InvalidOperation(String),
92
93 #[error("Error: {0}")]
95 Other(String),
96}
97
98pub type Result<T> = std::result::Result<T, MetricsError>;