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

Method exit_code

atomic-cli/src/error.rs:699–753  ·  view source on GitHub ↗

Get the exit code that should be used for this error. Different errors have different severity levels, reflected in their exit codes: - 1: General errors (user-fixable issues) - 2: Command-line usage errors - 3: Repository/data errors - 4: Remote/network errors - 128: Internal errors (bugs) # Returns The exit code to use when terminating due to this error.

(&self)

Source from the content-addressed store, hash-verified

697 ///
698 /// The exit code to use when terminating due to this error.
699 pub fn exit_code(&self) -> i32 {
700 match self {
701 Self::ShaclViolation { .. } => 1,
702 Self::ShaclError(_) => 3,
703 // User-fixable, general errors
704 Self::NothingToRecord
705 | Self::Cancelled
706 | Self::FileAlreadyTracked { .. }
707 | Self::RequiresForce { .. }
708 | Self::ServiceRefusal { .. }
709 | Self::ManagedAgentIncomplete { .. }
710 | Self::StaleBaseline { .. }
711 | Self::ViewAlreadyExists { .. } => 1,
712
713 // Command-line usage errors
714 Self::InvalidArgument { .. } => 2,
715
716 // Repository/data errors
717 Self::RepositoryNotFound { .. }
718 | Self::RepositoryExists { .. }
719 | Self::InvalidPath { .. }
720 | Self::InvalidRepository { .. }
721 | Self::ViewNotFound { .. }
722 | Self::CannotDeleteCurrentView { .. }
723 | Self::FileNotFound { .. }
724 | Self::FileNotTracked { .. }
725 | Self::PathOutsideRepository { .. }
726 | Self::PathIgnored { .. }
727 | Self::ChangeNotFound { .. }
728 | Self::VaultEntityNotFound { .. }
729 | Self::AmbiguousHash { .. }
730 | Self::MissingDependency { .. }
731 | Self::Conflict { .. }
732 | Self::ConflictMarkers { .. }
733 | Self::FileTooLarge { .. }
734 | Self::IdentityNotFound(_)
735 | Self::IdentityAlreadyExists(_) => 3,
736
737 // Remote/network errors
738 Self::RemoteError { .. }
739 | Self::RemoteNotFound { .. }
740 | Self::AuthenticationFailed { .. }
741 | Self::DelegationError { .. }
742 | Self::GitError { .. } => 4,
743
744 // IO and config errors
745 Self::Io(_) | Self::Config(_) => 3,
746
747 // Repository library errors
748 Self::Repository(_) => 3,
749
750 // Internal errors (bugs)
751 Self::Internal(_) => 128,
752 }
753 }
754}
755
756// Tests

Callers 3

mainFunction · 0.45
render_and_exitFunction · 0.45

Calls

no outgoing calls

Tested by 1