hlc_gen/
error.rs

1/// HLC error type.
2#[derive(Debug, PartialEq, Eq, thiserror::Error)]
3pub enum HlcError {
4    /// Timestamp is out of range.
5    #[error("Out of range timestamp")]
6    OutOfRangeTimestamp,
7
8    /// Drift is too large.
9    #[error("Drift exeeded the maximum allowed: {0} > {1}")]
10    DriftTooLarge(usize, usize),
11
12    /// Physical time exceeds maximum value.
13    #[error("Physical time exceeds maximum value: {0} > {1}")]
14    PhysicalTimeExceedsMax(i64, u64),
15
16    /// Logical clock exceeds maximum value.
17    #[error("Logical clock exceeds maximum value: {0} > {1}")]
18    LogicalClockExceedsMax(u64, u64),
19
20    /// Timestamp is below the minimum value.
21    #[error("Timestamp is below the minimum value: {0} < {1}")]
22    TimestampBelowMin(i64, i64),
23}
24
25/// HLC result type.
26pub type HlcResult<T> = Result<T, HlcError>;