pub enum GitError {
Show 16 variants
Io(String),
IoKind {
kind: ErrorKind,
message: String,
},
SidebandFatal(String),
InvalidObjectId(String),
InvalidObject(String),
InvalidFormat(String),
InvalidPath(String),
Unsupported(String),
NotFound(NotFoundKind),
Transaction(String),
Command(String),
Cli(CliExit, String),
Exit(i32),
Cancelled,
CountMismatch {
expected: u64,
actual: u64,
},
ResourceLimit {
kind: ResourceLimitKind,
limit: u64,
attempted: u64,
},
}Variants§
Io(String)
IoKind
An I/O failure that preserves the std::io::ErrorKind of the
underlying std::io::Error.
Produced by From<std::io::Error> so downstream code can branch on
GitError::io_kind instead of sniffing rendered message text. The
legacy GitError::Io variant remains for hand-built
messages and compatibility this cycle.
SidebandFatal(String)
A sideband channel-3 (fatal) message from a pack protocol response.
Typed marker produced where sideband demuxing surfaces remote aborts,
so recovery paths classify them by variant rather than substring-
matching "sideband fatal:" in rendered messages.
InvalidObjectId(String)
InvalidObject(String)
InvalidFormat(String)
InvalidPath(String)
Unsupported(String)
NotFound(NotFoundKind)
Transaction(String)
Command(String)
Cli(CliExit, String)
Typed CLI exit with a user-facing message printed by the binary entrypoint.
Exit(i32)
Legacy explicit exit code; the message (if any) was already printed by the command.
Cancelled
Cooperative cancellation of a streaming or long-running operation.
Raised when a CancelFlag trips mid-stream (pack index/install, pack
write, fetch demux, emit loops). Distinct from I/O failure so embedders
and the CLI can treat user-stop as non-corruption.
CountMismatch
A known-count stream yielded fewer or more items than the caller declared.
Used by pack generation so a truncated or overlong object-id iterator cannot produce a successful pack.
ResourceLimit
An explicit byte/count budget was exceeded.
Implementations§
Source§impl GitError
impl GitError
pub fn usage(msg: impl Into<String>) -> Self
pub fn user_error(msg: impl Into<String>) -> Self
pub fn cli_exit(kind: CliExit, msg: impl Into<String>) -> Self
pub fn cli_exit_code(&self) -> i32
pub fn not_found(msg: impl Into<String>) -> Self
pub fn remote_not_found(name: impl Into<String>) -> Self
pub fn object_not_found(oid: ObjectId) -> Self
pub fn object_kind_not_found(oid: ObjectId, kind: MissingObjectKind) -> Self
pub fn object_not_found_in(oid: ObjectId, context: MissingObjectContext) -> Self
pub fn object_kind_not_found_in( oid: ObjectId, kind: MissingObjectKind, context: MissingObjectContext, ) -> Self
pub fn reference_not_found(name: impl Into<String>) -> Self
pub fn broken_reference( name: impl Into<String>, target: impl Into<String>, ) -> Self
pub fn repository_not_found(path: impl Into<String>) -> Self
pub fn not_found_kind(&self) -> Option<&NotFoundKind>
pub fn count_mismatch(expected: u64, actual: u64) -> Self
pub fn resource_limit( kind: ResourceLimitKind, limit: u64, attempted: u64, ) -> Self
Sourcepub fn io_kind(&self) -> Option<ErrorKind>
pub fn io_kind(&self) -> Option<ErrorKind>
The preserved I/O std::io::ErrorKind, when this error originated
from (or was constructed with) an I/O error kind.
None for non-I/O variants and for the legacy string-only
GitError::Io form, whose kind was erased at construction.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether this error represents cooperative cancellation.
Uniformly covers:
- the explicit
GitError::Cancelledvariant (raised directly byCancelFlag, or via theOperationCancelledpayload intercept inFrom<std::io::Error>), and - structured I/O errors of kind
Interrupted— the EINTR-style wake-up the cancel machinery produces when a blocked read is interrupted after retries are exhausted, and - legacy string-form errors carrying “cancelled” text.
Trait Implementations§
impl Eq for GitError
Source§impl Error for GitError
impl Error for GitError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()