Skip to main content

cmdhub_shared/
error.rs

1//! Error types for CmdHub.
2
3use thiserror::Error;
4
5/// Top-level CmdHub error type.
6#[derive(Debug, Error)]
7pub enum CmdHubError {
8    #[error("IO error: {0}")]
9    Io(#[from] std::io::Error),
10
11    #[error("JSON error: {0}")]
12    Json(#[from] serde_json::Error),
13
14    #[error("Signature verification failed: {0}")]
15    SignatureVerification(String),
16
17    #[error("Database update failed: {0}")]
18    UpdateFailed(String),
19
20    #[error("Configuration error: {0}")]
21    Config(String),
22
23    #[error("Command not found: {query}")]
24    NotFound { query: String },
25
26    #[error("Execution blocked by safety guardrail: risk_level={risk_level}, command={command}")]
27    ExecutionBlocked { risk_level: String, command: String },
28
29    #[error("Validation error: {0}")]
30    Validation(String),
31}