Skip to main content

twine_models/support/thermo/
error.rs

1use thiserror::Error;
2
3/// Errors that may occur when evaluating thermodynamic properties.
4#[derive(Debug, Clone, PartialEq, Eq, Error)]
5pub enum PropertyError {
6    /// The property is undefined at the given state.
7    ///
8    /// For example, the specific heat capacity of a pure fluid within the vapor dome.
9    #[error("undefined property: {context}")]
10    Undefined { context: String },
11
12    /// The input state is outside the model's valid domain.
13    #[error("out of domain: {context}")]
14    OutOfDomain { context: String },
15
16    /// The provided state is invalid or inconsistent.
17    #[error("invalid state: {context}")]
18    InvalidState { context: String },
19
20    /// The calculation failed due to a numerical or internal error.
21    ///
22    /// For example, division by zero or a failure to converge.
23    #[error("calculation error: {context}")]
24    Calculation { context: String },
25}