Returns a user-facing suggestion for how to fix the error, if applicable.
(&self)
| 386 | |
| 387 | /// Returns a user-facing suggestion for how to fix the error, if applicable. |
| 388 | pub fn suggestion(&self) -> Option<&'static str> { |
| 389 | match self { |
| 390 | AgentError::WatchmanNotRunning => { |
| 391 | Some("Install Watchman or the fallback file watcher will be used automatically.") |
| 392 | } |
| 393 | AgentError::AlreadyInstalled { .. } => { |
| 394 | Some("Use `atomic agent enable --force` to reinstall hooks.") |
| 395 | } |
| 396 | AgentError::NotARepository { .. } => { |
| 397 | Some("Run `atomic init` to initialize a repository first.") |
| 398 | } |
| 399 | AgentError::SessionIdInvalid { .. } => { |
| 400 | Some("Session IDs must be alphanumeric with hyphens and underscores only.") |
| 401 | } |
| 402 | AgentError::TurnAlreadyActive { .. } => Some( |
| 403 | "This may indicate the previous turn was interrupted. Continuing with recovery.", |
| 404 | ), |
| 405 | AgentError::AgentNotFound { .. } => { |
| 406 | Some("Use `atomic agent enable --help` to see available agents.") |
| 407 | } |
| 408 | _ => None, |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | /// Returns a suggested exit code for CLI usage. |
| 413 | pub fn exit_code(&self) -> i32 { |
no outgoing calls