Skip to main content

tt_plan_core/
error.rs

1//! Errors surfaced by the Plan replay engine.
2
3use thiserror::Error;
4
5/// Error variants produced by [`crate::replay::replay`] and helpers.
6#[derive(Debug, Error)]
7pub enum PlanError {
8    /// The proposed config contains zero routes — there is nothing to replay.
9    #[error("proposed config has no routes")]
10    EmptyConfig,
11
12    /// The replay window is invalid (`window_end <= window_start`).
13    #[error("invalid plan window: window_end ({end}) must be after window_start ({start})")]
14    InvalidWindow {
15        /// Window start timestamp the caller supplied (RFC3339).
16        start: String,
17        /// Window end timestamp the caller supplied (RFC3339).
18        end: String,
19    },
20
21    /// Bootstrap iterations was set to zero — every CI would be `(0, 0)`,
22    /// which is almost certainly a caller mistake.
23    #[error("bootstrap_iterations must be > 0")]
24    ZeroBootstrapIterations,
25
26    /// An internal invariant was violated (e.g., percentile computation on
27    /// an empty slice). Holds a free-form description for the logs.
28    #[error("plan replay internal invariant violated: {0}")]
29    Internal(String),
30}