tpt_sci_sim_core/error.rs
1use thiserror::Error;
2
3/// Errors raised while orchestrating a [`Simulation`](crate::Simulation) or
4/// advancing a [`SubModel`](crate::SubModel).
5#[derive(Debug, Error)]
6pub enum SimError {
7 /// A sub-model was registered with an id that is already in use.
8 #[error("duplicate sub-model id: {0}")]
9 DuplicateModel(String),
10
11 /// A referenced sub-model id does not exist in the simulation.
12 #[error("unknown sub-model id: {0}")]
13 UnknownModel(String),
14
15 /// The target time for `step_until` was not strictly greater than the
16 /// current global time.
17 #[error("step_until target {0} is not ahead of current time {1}")]
18 NonAdvancingStep(f64, f64),
19
20 /// A sub-model failed while advancing its internal state.
21 #[error("sub-model '{0}' failed to advance: {1}")]
22 Advance(String, String),
23
24 /// A coupling referenced a model that does not expose an input buffer.
25 #[error("coupling target '{0}' exposes no input buffer")]
26 CouplingTargetNoInput(String),
27}