Returns a suggested exit code for CLI usage.
(&self)
| 411 | |
| 412 | /// Returns a suggested exit code for CLI usage. |
| 413 | pub fn exit_code(&self) -> i32 { |
| 414 | match self { |
| 415 | // User errors |
| 416 | AgentError::NotARepository { .. } => 1, |
| 417 | AgentError::AgentNotFound { .. } => 1, |
| 418 | AgentError::SessionIdInvalid { .. } => 1, |
| 419 | |
| 420 | // Operational errors (retryable) |
| 421 | AgentError::WatchmanNotRunning => 0, // Not fatal — fallback used |
| 422 | AgentError::CaptureInvalid { .. } => 0, // Not fatal — classified turn |
| 423 | |
| 424 | // Infrastructure errors |
| 425 | AgentError::WatchmanConnectionFailed { .. } => 2, |
| 426 | AgentError::Io(_) => 2, |
| 427 | |
| 428 | // Data errors |
| 429 | AgentError::HookParseFailed { .. } => 3, |
| 430 | AgentError::SessionLoadFailed { .. } => 3, |
| 431 | AgentError::EnvelopeCodecError { .. } => 3, |
| 432 | |
| 433 | // Recording errors |
| 434 | AgentError::RecordFailed { .. } => 4, |
| 435 | AgentError::ViewError { .. } => 4, |
| 436 | |
| 437 | // Everything else |
| 438 | _ => 1, |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | // Conversions from external error types |
nothing calls this directly
no outgoing calls
no test coverage detected