minerva 0.2.0

Causal ordering for distributed systems
use thiserror::Error;

use crate::metis::dot_set::HaveSetDecodeError;

/// A witnessed-cut embedding failed to decode.
///
/// Lifecycle cuts use canonical gap-free have-set embeddings. The
/// receiver proves gap-freedom before the value enters a `Cut` role.
#[non_exhaustive]
#[derive(Error, Debug, Clone, Copy, PartialEq, Eq)]
pub enum WireCutError {
    /// The embedded have-set frame is malformed or non-canonical.
    #[error("embedded cut frame: {0}")]
    HaveSet(#[from] HaveSetDecodeError),
    /// The embedded have-set carries an exception run and is not a cut.
    #[error("embedded cut is gapped: station {station} claims an exception run at {start}")]
    Gapped {
        /// The station carrying the first exception run.
        station: u32,
        /// The first exception run's starting dot index.
        start: u64,
    },
}