44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
//! Error types for the digital twin platform.
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Errors that can occur in digital twin operations.
|
|
#[derive(Error, Debug)]
|
|
pub enum DigitalTwinError {
|
|
/// Invalid geometry configuration
|
|
#[error("Invalid geometry: {0}")]
|
|
InvalidGeometry(String),
|
|
|
|
/// Unknown tissue type
|
|
#[error("Unknown tissue type: {0}")]
|
|
UnknownTissue(String),
|
|
|
|
/// Simulation error
|
|
#[error("Simulation error: {0}")]
|
|
SimulationError(String),
|
|
|
|
/// Invalid boundary condition
|
|
#[error("Invalid boundary condition: {0}")]
|
|
InvalidBoundaryCondition(String),
|
|
|
|
/// Shape mismatch
|
|
#[error("Shape mismatch: expected {expected:?}, got {got:?}")]
|
|
ShapeMismatch {
|
|
/// Expected shape
|
|
expected: [usize; 3],
|
|
/// Actual shape
|
|
got: [usize; 3],
|
|
},
|
|
|
|
/// Intervention error
|
|
#[error("Intervention error: {0}")]
|
|
InterventionError(String),
|
|
|
|
/// IO error
|
|
#[error("IO error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
}
|
|
|
|
/// Result type for digital twin operations.
|
|
pub type Result<T> = std::result::Result<T, DigitalTwinError>;
|