1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use thiserror::Error;

/// `SimulationError` enumerates all possible errors returned by sim
#[derive(Error, Debug)]
pub enum SimulationError {
    /// Represents an invalid model configuration encountered during simulation
    #[error("An invalid model configuration was encountered during simulation")]
    InvalidModelConfiguration,

    /// Represents an operation requested on a model that does not exist
    #[error("A specified model cannot be found in the simulation")]
    ModelNotFound,

    /// Represents an operation requested on a model port that does not exist
    #[error("A specified model port cannot be found in the simulation")]
    PortNotFound,

    /// Represents a failed clone operation on a model
    #[error("A model failed to clone during simulation")]
    ModelCloneError,

    /// Represents an invalid model state
    #[error("An invalid model state was encountered")]
    InvalidModelState,

    /// Represents an invalid state of event scheduling
    #[error("An invalid state was encountered, with respect to event scheduling")]
    EventSchedulingError,

    /// Represents an invalid inter-model message encountered
    #[error("An invalid inter-model message was encountered")]
    InvalidMessage,

    /// Represents a failed serialization operation
    #[error("Failed to serialize a simulation model")]
    SerializationError,

    /// Represents an empty polynomial configuration used in a simulation
    #[error("A polynomial was configured in a simulation, but the coefficients are empty")]
    EmptyPolynomial,

    /// Represents an internal logic error, where prerequisite calculations were not executed
    #[error("An internal logic error occured, where prerequisite calculations were not executed")]
    PrerequisiteCalcError,

    /// Represents a failed conversion to num-traits Float
    #[error("Failed to convert to a Float value")]
    FloatConvError,

    /// Transparent serde_json errors
    #[error(transparent)]
    JSONError(#[from] serde_json::error::Error),

    /// Transparent Beta distribution errors
    #[error(transparent)]
    BetaError(#[from] rand_distr::BetaError),

    /// Transparent Exponential distribution errors
    #[error(transparent)]
    ExpError(#[from] rand_distr::ExpError),

    /// Transparent Gamma distribution errors
    #[error(transparent)]
    GammaError(#[from] rand_distr::GammaError),

    /// Transparent Normal distribution errors
    #[error(transparent)]
    NormalError(#[from] rand_distr::NormalError),

    /// Transparent Triangular distribution errors
    #[error(transparent)]
    TriangularError(#[from] rand_distr::TriangularError),

    /// Transparent Weibull distribution errors
    #[error(transparent)]
    WeibullError(#[from] rand_distr::WeibullError),

    /// Transparent Bernoulli distribution errors
    #[error(transparent)]
    BernoulliError(#[from] rand_distr::BernoulliError),

    /// Transparent Geometric distribution errors
    #[error(transparent)]
    GeoError(#[from] rand_distr::GeoError),

    /// Transparent Poisson distribution errors
    #[error(transparent)]
    PoissonError(#[from] rand_distr::PoissonError),

    /// Transparent Weighted Index distribution errors
    #[error(transparent)]
    WeightedError(#[from] rand_distr::WeightedError),
}