Skip to main content

nexus_memory_hooks/
error.rs

1//! Error types for the hooks system
2
3use thiserror::Error;
4
5/// Hook-specific errors
6#[derive(Debug, Error)]
7pub enum HookError {
8    #[error("Agent not found: {0}")]
9    AgentNotFound(String),
10
11    #[error("Hook installation failed: {0}")]
12    InstallationFailed(String),
13
14    #[error("Session detection failed: {0}")]
15    DetectionFailed(String),
16
17    #[error("Context extraction failed: {0}")]
18    ExtractionFailed(String),
19
20    #[error("Buffer error: {0}")]
21    BufferError(String),
22
23    #[error("Process monitoring error: {0}")]
24    MonitorError(String),
25
26    #[error("Signal handling error: {0}")]
27    SignalError(String),
28
29    #[error("IO error: {0}")]
30    Io(#[from] std::io::Error),
31
32    #[error("Serialization error: {0}")]
33    Serialization(#[from] serde_json::Error),
34
35    #[error("Configuration error: {0}")]
36    ConfigError(String),
37
38    #[error("Agent not supported: {0}")]
39    NotSupported(String),
40
41    #[error("Hook not initialized")]
42    NotInitialized,
43
44    #[error("Session not active")]
45    SessionNotActive,
46
47    #[error("Timeout exceeded")]
48    Timeout,
49
50    #[error("Internal error: {0}")]
51    Internal(String),
52}
53
54/// Result type alias for hook operations
55pub type Result<T> = std::result::Result<T, HookError>;