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

Method exit_code

atomic-cli/src/error.rs:712–766  ·  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

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

Callers 3

mainFunction · 0.45
render_and_exitFunction · 0.45

Calls

no outgoing calls

Tested by 1