pub enum SimError {
Show 15 variants
NonFiniteValue {
location: String,
},
EnergyDrift {
drift: f64,
tolerance: f64,
},
ConstraintViolation {
name: String,
violation: f64,
tolerance: f64,
},
Config {
message: String,
},
YamlParse(Error),
Validation(ValidationErrors),
CheckpointIntegrity,
CheckpointNotFound(SimTime),
Journal(String),
Io(Error),
Serialization(String),
Physics(String),
MonteCarlo(String),
Optimization(String),
HypothesisFalsified {
reason: String,
p_value: f64,
},
}Expand description
Unified error type for all simular operations.
§Design
Following Toyota’s Jidoka principle, errors are:
- Immediately detectable (type-safe)
- Self-documenting (descriptive variants)
- Actionable (contain recovery hints)
Variants§
NonFiniteValue
Numerical instability detected (NaN or Inf).
EnergyDrift
Energy conservation violated beyond tolerance.
Fields
ConstraintViolation
Constraint violation detected.
Fields
Config
Invalid configuration parameter.
YamlParse(Error)
YAML parsing error.
Validation(ValidationErrors)
Validation error.
CheckpointIntegrity
Checkpoint integrity violation.
CheckpointNotFound(SimTime)
Checkpoint not found.
Journal(String)
Journal read error.
Io(Error)
File I/O error.
Serialization(String)
Serialization error.
Physics(String)
Physics engine error.
MonteCarlo(String)
Monte Carlo error.
Optimization(String)
Optimization error.
HypothesisFalsified
Hypothesis falsified.
Implementations§
Source§impl SimError
impl SimError
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Create a serialization error.
Sourcepub fn optimization(message: impl Into<String>) -> Self
pub fn optimization(message: impl Into<String>) -> Self
Create an optimization error.
Sourcepub fn jidoka(message: impl Into<String>) -> Self
pub fn jidoka(message: impl Into<String>) -> Self
Create a Jidoka violation error (requires immediate stop).
Sourcepub fn io(message: impl Into<String>) -> Self
pub fn io(message: impl Into<String>) -> Self
Create an I/O error with a message (wraps in std::io::Error).
Sourcepub const fn is_jidoka_violation(&self) -> bool
pub const fn is_jidoka_violation(&self) -> bool
Check if this error is a Jidoka violation (requires immediate stop).
Trait Implementations§
Source§impl Error for SimError
impl Error for SimError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<JidokaViolation> for SimError
impl From<JidokaViolation> for SimError
Source§fn from(v: JidokaViolation) -> Self
fn from(v: JidokaViolation) -> Self
Source§impl From<ValidationErrors> for SimError
impl From<ValidationErrors> for SimError
Source§fn from(source: ValidationErrors) -> Self
fn from(source: ValidationErrors) -> Self
Auto Trait Implementations§
impl Freeze for SimError
impl !RefUnwindSafe for SimError
impl Send for SimError
impl Sync for SimError
impl Unpin for SimError
impl !UnwindSafe for SimError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.