Skip to main content

hermes_bot/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in Hermes.
4#[derive(Debug, Error)]
5pub enum HermesError {
6    /// Configuration file error (missing, invalid, etc.)
7    #[error("Configuration error: {0}")]
8    Config(String),
9
10    /// Session not found for the given thread
11    #[error("Session not found for thread '{0}'")]
12    SessionNotFound(String),
13
14    /// Claude CLI binary not found in PATH
15    #[error("Claude CLI not found in PATH. Install it from: https://docs.anthropic.com/en/docs/claude-code")]
16    ClaudeNotFound,
17
18    /// Failed to spawn the Claude CLI process
19    #[error("Failed to spawn Claude CLI: {reason}")]
20    AgentSpawnFailed { reason: String },
21
22    /// Slack API call failed
23    #[error("Slack API error: {0}")]
24    SlackApi(String),
25
26    /// Filesystem I/O error
27    #[error("IO error: {0}")]
28    Io(#[from] std::io::Error),
29
30    /// JSON serialization/deserialization error
31    #[error("JSON error: {0}")]
32    Json(#[from] serde_json::Error),
33
34    /// TOML configuration parse error
35    #[error("TOML parse error: {0}")]
36    Toml(#[from] toml::de::Error),
37}
38
39pub type Result<T> = std::result::Result<T, HermesError>;