| 38 | /// Errors that can occur during agent operations. |
| 39 | #[derive(Debug, Error)] |
| 40 | pub enum AgentError { |
| 41 | // Watchman / File Watcher Errors |
| 42 | /// Watchman daemon is not running or not installed. |
| 43 | /// |
| 44 | /// This is a soft error — the system falls back to the polling-based |
| 45 | /// `FallbackWatcher` when Watchman is unavailable. |
| 46 | #[error("Watchman is not running (install from https://facebook.github.io/watchman/ or the fallback watcher will be used)")] |
| 47 | WatchmanNotRunning, |
| 48 | |
| 49 | /// Failed to connect to the Watchman daemon. |
| 50 | #[error("Failed to connect to Watchman: {reason}")] |
| 51 | WatchmanConnectionFailed { |
| 52 | /// Human-readable reason for the connection failure. |
| 53 | reason: String, |
| 54 | }, |
| 55 | |
| 56 | /// A Watchman query or command failed. |
| 57 | #[error("Watchman query failed: {reason}")] |
| 58 | WatchmanQueryFailed { |
| 59 | /// Human-readable reason for the query failure. |
| 60 | reason: String, |
| 61 | }, |
| 62 | |
| 63 | /// Failed to resolve the repository root with Watchman. |
| 64 | #[error("Watchman failed to resolve watch root for path: {path}")] |
| 65 | WatchmanResolveRoot { |
| 66 | /// The path that could not be resolved. |
| 67 | path: PathBuf, |
| 68 | }, |
| 69 | |
| 70 | // Hook Parsing Errors |
| 71 | /// Failed to parse JSON input from an agent hook callback. |
| 72 | #[error("Failed to parse hook input for {agent} ({hook_type}): {reason}")] |
| 73 | HookParseFailed { |
| 74 | /// Which agent sent the hook (e.g., "claude-code", "gemini-cli"). |
| 75 | agent: String, |
| 76 | /// The hook type that failed to parse (e.g., "stop", "user-prompt-submit"). |
| 77 | hook_type: String, |
| 78 | /// What went wrong during parsing. |
| 79 | reason: String, |
| 80 | }, |
| 81 | |
| 82 | /// Hook input was empty (stdin had no data). |
| 83 | #[error("Empty hook input from {agent} for hook type {hook_type}")] |
| 84 | HookInputEmpty { |
| 85 | /// Which agent sent the empty input. |
| 86 | agent: String, |
| 87 | /// The hook type that received empty input. |
| 88 | hook_type: String, |
| 89 | }, |
| 90 | |
| 91 | /// A required field was missing from the hook input JSON. |
| 92 | #[error("Missing required field '{field}' in {agent} hook input for {hook_type}")] |
| 93 | HookFieldMissing { |
| 94 | /// Which agent sent the input. |
| 95 | agent: String, |
| 96 | /// The hook type. |
| 97 | hook_type: String, |
nothing calls this directly
no outgoing calls
no test coverage detected