pub enum Error {
Show 33 variants
Unsupported {
operation: &'static str,
},
RepoNotFound(PathBuf),
DirtyWorkingTree {
operation: &'static str,
},
Conflict {
operation: &'static str,
},
PushRejected(PushRejection),
RemoteGroupPending {
branch: String,
run_id: String,
},
NotFastForward,
RewordRefused(RewordRefusal),
SplitRefused(SplitRefusal),
RewriteRefused(RewriteRefusal, String),
ApplyRefused(ApplyRefusal),
RebaseRefused(RebaseRefusal),
ConflictRefused(ConflictRefusal),
UndoRefused(UndoRefusal),
NeedsConfirmation(String),
LfsUnavailable {
reason: LfsUnavailableReason,
},
LfsLockingUnsupported {
remote: String,
},
NeedsAutoStash {
operation: String,
},
PendingAutoStash {
operation: String,
stash: StashId,
hint: String,
},
NotBuilt {
feature: &'static str,
},
RepoAuthUnavailable {
reason: String,
},
TokenCommandFailed {
exit: Option<i32>,
stderr_tail: String,
},
RepoAuthCommandChanged {
path: String,
},
GrantRefused {
host: String,
expected: String,
},
CredentialHelperUnreachable,
Canceled {
job: u64,
},
NotCancellable {
reason: NotCancellableReason,
},
JobConflict {
existing: u64,
},
HooksNotTrusted {
hash: String,
hooks: Vec<HookInfo>,
},
SensitiveStage {
files: Vec<Sensitive>,
},
Backend(String),
Git {
message: String,
detail: Box<ErrorDetail>,
},
Io(Error),
}Variants§
Unsupported
RepoNotFound(PathBuf)
DirtyWorkingTree
Conflict
PushRejected(PushRejection)
The remote refused a push in a way the user can act on: it has
commits we do not (NonFastForward), or a lease found it moved
(StaleLease). A variant rather than a Backend string because
the TUI answers it with a dialog (pull first / force with lease /
cancel), and a dialog keyed on git’s English stderr would break
on the first localised git.
RemoteGroupPending
A grouped push or pull of branch is saved (stopped on conflicts,
canceled or with targets to retry): continue, retry or abort it
(resume) instead of starting another. Nothing was changed.
NotFastForward
A fast-forward-only pull found the branch and its upstream
diverged, or GitBackend::fast_forward found the branch and its
target diverged. Nothing was changed.
RewordRefused(RewordRefusal)
reword refused before changing anything (see
RewordRefusal). Typed because the TUI words each case
differently and the CLI reports it as a stable code.
SplitRefused(SplitRefusal)
split_commit refused before changing anything (see
SplitRefusal).
RewriteRefused(RewriteRefusal, String)
A history rewrite refused before changing anything (see
RewriteRefusal); the string says which rule, path or ref.
ApplyRefused(ApplyRefusal)
apply_commit_to_worktree refused before changing anything (see
ApplyRefusal).
RebaseRefused(RebaseRefusal)
An interactive rebase (or continue/skip/abort) refused
before changing anything (see RebaseRefusal).
ConflictRefused(ConflictRefusal)
A conflict call (resolve_conflict, unresolve_conflict,
operation_abort) refused before changing anything (see
ConflictRefusal).
UndoRefused(UndoRefusal)
An undo or redo (or a compare-and-swap ref update) refused before
changing anything (see UndoRefusal).
NeedsConfirmation(String)
An undo or redo that is risky (it would overwrite working-tree
files, or the undone commit is already on its upstream) and was
not sent with confirmed. Nothing was changed; the prompt names
what is at stake.
An LFS operation needs the git-lfs program and it is missing (or
too old). Typed so every frontend can show the install link
instead of git’s raw “‘lfs’ is not a git command”.
LfsLockingUnsupported
The LFS remote does not implement the locking API.
NeedsAutoStash
operation was blocked by local changes, general.auto_stash is
ask, and nobody was there to answer. Nothing was changed. A UI
answers with its dialog and resends the request with
autostash: "always"; a CLI/MCP caller reads the message and
passes --autostash. Typed so the TUI never matches on git’s
English stderr.
PendingAutoStash
The repository has a pending auto-stash (stash is its index in
the stash list) and operation would bury or tangle it. Nothing
was changed. hint says how to resolve it. Typed so each frontend
can point at its own resolving actions.
NotBuilt
The operation belongs to a feature this binary was built without
(a custom build, see docs/user/custom-builds.md). feature is the
cargo feature name (lfs, worktree, …). Typed so each frontend
words it in its own language and the CLI reports a stable code.
The repository’s authentication profile cannot be used (its file is unreadable, the integration it names is gone, a key file is missing, or the source is not available in this version). The transfer is refused: it never falls back to the machine’s own credentials, because pushing to work with a personal account is the failure to avoid.
TokenCommandFailed
The repository’s token command did not give a token: it exited
non-zero (exit), timed out or could not start (exit is None), or
printed nothing usable. stderr_tail is the end of its standard error,
already redacted (it never carries the token). The transfer is refused.
RepoAuthCommandChanged
A file the confirmed credential helper or token command runs, inside
the repository’s work tree, is not the one the person confirmed (a pull
can change a tracked script). path names it. The transfer is
refused until the command is confirmed again.
GrantRefused
The transfer was refused credentials because git asked for a host that
is not the account’s own address: host is where git went (a remote
URL rewritten by the repository’s own url.<x>.insteadOf, say),
expected the address the account’s token is bound to. The token was
not sent.
CredentialHelperUnreachable
git needed a credential from GitPoulpi’s credential helper and got none because the helper never reached the daemon that issued the grant (the daemon was gone or its endpoint could not be read). Nothing was sent to the server.
Canceled
A background job was canceled (JobCancel, or a client that asked for
cancel-on-disconnect went away). The repository is as it was before the
operation, or at its last safe point (see the cancel policy in
the background-ops design`). Every caller waiting on the
job, the one that started it and the ones that joined it, gets this.
NotCancellable
JobCancel on a job that cannot be stopped safely right now (it is
past its point of no return, or it has already ended). Nothing was
changed.
Fields
reason: NotCancellableReasonJobConflict
A second request for a job that must not run twice (a clone into a
destination another clone is filling). existing is the job already
running.
HooksNotTrusted
The committed workflow hooks were asked to run but this user has not
trusted them as they are now. Nothing ran. hash is what
FlowTrustHooks takes, hooks the exact commands.
SensitiveStage
A stage request would add files that look sensitive (a private key, a
.env, a recognised token) and the caller did not allow it. Nothing
was staged. files lists each file with its reason, never a value.
Backend(String)
Git
A backend failure with its facts attached (the command that ran, its
exit code and stderr, or libgit2’s class and code), so a frontend can
say what went wrong instead of “the backend failed”. Display is
the same text a plain Backend error would have.
Io(Error)
Implementations§
Source§impl Error
impl Error
Sourcepub fn typed(&self) -> Option<TypedError>
pub fn typed(&self) -> Option<TypedError>
The typed part of this error, if it has one.
Sourcepub fn detail(&self) -> Option<&ErrorDetail>
pub fn detail(&self) -> Option<&ErrorDetail>
The facts of the failure, when the backend recorded them.
Sourcepub fn git(message: impl Into<String>, detail: ErrorDetail) -> Self
pub fn git(message: impl Into<String>, detail: ErrorDetail) -> Self
A backend failure carrying detail.
Sourcepub fn from_wire(message: String, detail: Option<ErrorDetail>) -> Self
pub fn from_wire(message: String, detail: Option<ErrorDetail>) -> Self
Error::from_wire_message with the detail that travelled beside
the message, when there was one.
Sourcepub fn from_wire_message(message: String) -> Self
pub fn from_wire_message(message: String) -> Self
An error that arrived over the wire as plain text: the daemon sent
Error’s own Display, which for a backend failure already starts
with backend error: . Wrapping that text in Error::Backend
again would print the prefix twice, so it is taken off first.
Sourcepub fn from_typed(typed: TypedError) -> Self
pub fn from_typed(typed: TypedError) -> Self
The inverse of Error::typed.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()