belief_spread/
errors.rs

1//! This module contains various errors that may be produced.
2use thiserror::Error;
3use uuid::Uuid;
4
5use crate::SimTime;
6
7/// An error for when a supplied value is out of range.
8#[derive(Error, Debug, PartialEq)]
9pub enum OutOfRangeError {
10    /// When a value is too low.
11    #[error("value too low (found {found:?}, range [{min:?}, {max:?}])")]
12    TooLow { found: f64, min: f64, max: f64 },
13    /// When a value is too high.
14    #[error("value too high (found {found:?}, range [{min:?}, {max:?}])")]
15    TooHigh { found: f64, min: f64, max: f64 },
16}
17
18/// An error for [`crate::update_activation_for_agent`].
19#[derive(Error, Debug, PartialEq)]
20pub enum UpdateActivationError {
21    /// When the activation for a [`crate::Belief`] identified by [Uuid] at a [SimTime] is [None].
22    #[error("Get activation is none")]
23    GetActivationNone { time: SimTime, belief: Uuid },
24
25    /// When the delta for a [`crate::Belief`] identified by [Uuid] is [None].
26    #[error("Get delta is none")]
27    GetDeltaNone { belief: Uuid },
28}