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

Method exit_code

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

646 ///
647 /// The exit code to use when terminating due to this error.
648 pub fn exit_code(&self) -> i32 {
649 match self {
650 // User-fixable, general errors
651 Self::NothingToRecord
652 | Self::Cancelled
653 | Self::FileAlreadyTracked { .. }
654 | Self::RequiresForce { .. }
655 | Self::ViewAlreadyExists { .. } => 1,
656
657 // Command-line usage errors
658 Self::InvalidArgument { .. } => 2,
659
660 // Repository/data errors
661 Self::RepositoryNotFound { .. }
662 | Self::RepositoryExists { .. }
663 | Self::InvalidPath { .. }
664 | Self::InvalidRepository { .. }
665 | Self::ViewNotFound { .. }
666 | Self::CannotDeleteCurrentView { .. }
667 | Self::FileNotFound { .. }
668 | Self::FileNotTracked { .. }
669 | Self::PathOutsideRepository { .. }
670 | Self::PathIgnored { .. }
671 | Self::ChangeNotFound { .. }
672 | Self::VaultEntityNotFound { .. }
673 | Self::AmbiguousHash { .. }
674 | Self::MissingDependency { .. }
675 | Self::Conflict { .. }
676 | Self::ConflictMarkers { .. }
677 | Self::FileTooLarge { .. }
678 | Self::IdentityNotFound(_)
679 | Self::IdentityAlreadyExists(_) => 3,
680
681 // Remote/network errors
682 Self::RemoteError { .. }
683 | Self::RemoteNotFound { .. }
684 | Self::AuthenticationFailed { .. }
685 | Self::DelegationError { .. }
686 | Self::GitError { .. } => 4,
687
688 // IO and config errors
689 Self::Io(_) | Self::Config(_) => 3,
690
691 // Repository library errors
692 Self::Repository(_) => 3,
693
694 // Internal errors (bugs)
695 Self::Internal(_) => 128,
696 }
697 }
698}
699
700// Tests

Callers 3

mainFunction · 0.45
render_and_exitFunction · 0.45

Calls

no outgoing calls

Tested by 1