pub struct ExitCode(/* private fields */);Expand description
Exit codes matching the documented exit code table.
ExitCode provides type-safe exit code handling for xchecker operations.
Use the named constants for common exit codes, or as_i32()
to get the numeric value for std::process::exit().
This is a stable public type. The numeric values are part of the public API and will not change in 1.x releases.
§Constants
| Constant | Value | Description |
|---|---|---|
SUCCESS | 0 | Operation completed successfully |
INTERNAL | 1 | General/internal failure |
CLI_ARGS | 2 | Invalid CLI arguments |
PACKET_OVERFLOW | 7 | Packet size exceeded |
SECRET_DETECTED | 8 | Secret found in content |
LOCK_HELD | 9 | Lock already held |
PHASE_TIMEOUT | 10 | Phase timed out |
CLAUDE_FAILURE | 70 | Claude CLI failed |
§Example
use xchecker_utils::exit_codes::ExitCode;
// Using named constants
let code = ExitCode::SUCCESS;
assert_eq!(code.as_i32(), 0);
let code = ExitCode::PACKET_OVERFLOW;
assert_eq!(code.as_i32(), 7);
// Comparing exit codes
assert_eq!(ExitCode::SUCCESS, ExitCode::from_i32(0));§Integration with XCheckerError
Use XCheckerError::to_exit_code() to map
errors to exit codes:
use xchecker_utils::error::ConfigError;
use xchecker_utils::error::XCheckerError;
use xchecker_utils::exit_codes::ExitCode;
let err = XCheckerError::Config(ConfigError::InvalidFile("test".to_string()));
assert_eq!(err.to_exit_code(), ExitCode::CLI_ARGS);Implementations§
Source§impl ExitCode
impl ExitCode
Sourcepub const PACKET_OVERFLOW: ExitCode
pub const PACKET_OVERFLOW: ExitCode
Packet overflow - input packet exceeded size limits before Claude invocation
Sourcepub const SECRET_DETECTED: ExitCode
pub const SECRET_DETECTED: ExitCode
Secret detected - redaction system detected potential secrets
Sourcepub const PHASE_TIMEOUT: ExitCode
pub const PHASE_TIMEOUT: ExitCode
Phase timeout - phase execution exceeded configured timeout
Sourcepub const CLAUDE_FAILURE: ExitCode
pub const CLAUDE_FAILURE: ExitCode
Claude failure - underlying Claude CLI invocation failed
Trait Implementations§
impl Copy for ExitCode
impl Eq for ExitCode
impl StructuralPartialEq for ExitCode
Auto Trait Implementations§
impl Freeze for ExitCode
impl RefUnwindSafe for ExitCode
impl Send for ExitCode
impl Sync for ExitCode
impl Unpin for ExitCode
impl UnsafeUnpin for ExitCode
impl UnwindSafe for ExitCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.