Skip to main content

aivcs_core/hitl_controls/
error.rs

1//! Error types for the HITL controls module.
2
3/// Errors produced by the human-in-the-loop controls layer.
4#[derive(Debug, thiserror::Error)]
5pub enum HitlError {
6    #[error("approval request expired after {timeout_secs}s")]
7    Expired { timeout_secs: u64 },
8
9    #[error("approval rejected by {reviewer}: {reason}")]
10    Rejected { reviewer: String, reason: String },
11
12    #[error("duplicate vote from {voter} on checkpoint {checkpoint_id}")]
13    DuplicateVote {
14        voter: String,
15        checkpoint_id: String,
16    },
17
18    #[error("checkpoint not found: {0}")]
19    CheckpointNotFound(String),
20
21    #[error("intervention failed: {0}")]
22    InterventionFailed(String),
23
24    #[error("invalid policy configuration: {0}")]
25    InvalidPolicy(String),
26
27    #[error("domain error: {0}")]
28    Domain(#[from] crate::domain::error::AivcsError),
29}
30
31/// Result type for HITL operations.
32pub type HitlResult<T> = std::result::Result<T, HitlError>;