MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / exit_code

Method exit_code

atomic-agent/src/error.rs:413–440  ·  view source on GitHub ↗

Returns a suggested exit code for CLI usage.

(&self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected