use thiserror::Error;
#[derive(Error, Debug)]
pub enum MetricsError {
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Calculation error: {0}")]
CalculationError(String),
#[error("Computation error: {0}")]
ComputationError(String),
#[error("Dimension mismatch: {0}")]
DimensionMismatch(String),
#[error("Shape mismatch: shape1 = {shape1}, shape2 = {shape2}")]
ShapeMismatch {
shape1: String,
shape2: String,
},
#[error("Invalid argument: {0}")]
InvalidArgument(String),
#[error("Division by zero")]
DivisionByZero,
#[error("Statistics error: {0}")]
StatsError(String),
#[error("Linear algebra error: {0}")]
LinalgError(String),
#[error("IO error: {0}")]
IOError(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Deserialization error: {0}")]
DeserializationError(String),
#[error("Visualization error: {0}")]
VisualizationError(String),
#[error("Memory error: {0}")]
MemoryError(String),
#[error("Index error: {0}")]
IndexError(String),
#[error("Core error: {0}")]
CoreError(#[from] scirs2_core::error::CoreError),
#[error("Consensus error: {0}")]
ConsensusError(String),
#[error("Sharding error: {0}")]
ShardingError(String),
#[error("Fault tolerance error: {0}")]
FaultToleranceError(String),
#[error("Invalid operation: {0}")]
InvalidOperation(String),
#[error("Error: {0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, MetricsError>;