#[non_exhaustive]pub enum Error {
NotARepository(PathBuf),
BareRepository(PathBuf),
WorktreeNotFound(PathBuf),
Io(Error),
Vcs(Error),
Rollback(Rollback),
Unsupported(String),
}Expand description
An error from a Repo operation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotARepository(PathBuf)
Repo::discover found no .git/.jj from the
start dir up to the filesystem root, or Repo::open
found no .git/.jj marker in the exact directory it was given.
BareRepository(PathBuf)
Repo::discover walked up to a bare git
repository (created with git init --bare, or an equivalent bare clone)
— a directory holding HEAD/config/objects/refs directly, with no
.git subdirectory and no worktree. This is distinct from
NotARepository: a bare repository is a
valid git repository, just one this facade doesn’t drive (it has no
working tree for the CLI wrappers to operate against). See
https://github.com/ZelAnton/vcs-toolkit-rs/issues/6.
WorktreeNotFound(PathBuf)
A worktree/workspace lookup by path matched no attached worktree.
Io(Error)
A filesystem operation failed (e.g. removing a workspace directory).
Vcs(Error)
An underlying vcs-git / vcs-jj (i.e. processkit) error.
Rollback(Rollback)
A concurrency-safe op-log rollback could not restore the repository to its
captured pre-operation state: the op restore failed, or a concurrent jj
process advanced the operation log so reverting would have clobbered its work
(see vcs_jj::Rollback). Raised by
Repo::try_merge on the jj backend when its
trial-merge rollback cannot complete cleanly — the trial merge may remain
materialized, so the probe result would be untrustworthy. The structured
vcs_jj::Rollback carries which case it was (and, for a failed restore, the
underlying cause).
Unsupported(String)
The requested action has no meaningful mapping for the repository’s current
in-progress state, so it is refused explicitly rather than performed as a
misleading success. Currently raised by
Repo::continue_in_progress during a
git bisect: a bisect advances by marking commits good/bad, not by a
--continue step, so “continue” cannot be honoured. Carries a short message
naming the situation. Classified by
is_unsupported; a language binding maps it to an
unsupported/ValueError-style error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_merge_conflict(&self) -> bool
pub fn is_merge_conflict(&self) -> bool
Whether this wraps a merge/rebase conflict from the backend — so a
caller can branch on “conflict, resolve it” vs. a hard failure without
matching on processkit::Error internals. (Recognises git’s conflict
markers; jj surfaces conflicts as state, not errors — see
Repo::in_progress_state.)
Named to match the wrapper classifiers
(vcs_cli_support::is_merge_conflict) — one name per concept across the
workspace.
Sourcepub fn is_nothing_to_commit(&self) -> bool
pub fn is_nothing_to_commit(&self) -> bool
Whether this is a benign “nothing to commit” — an empty commit attempt the caller likely wants to treat as a no-op.
Sourcepub fn is_transient_fetch_error(&self) -> bool
pub fn is_transient_fetch_error(&self) -> bool
Whether this is a transient fetch/network failure worth retrying — DNS, a
dropped connection, a fast blip. A timeout is not transient (it already
spent the full deadline; retrying would multiply the wall-clock — see
vcs_cli_support::is_transient_fetch_error). The underlying clients already
retry their own fetches; this is for retrying higher-level flows.
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether the underlying error is a transient io/spawn failure
(interrupted / would-block / resource-busy) — delegates to
processkit::Error::is_transient. Narrower than
is_transient_fetch_error (which also
treats the network markers as retryable — but not a timeout); use this to retry
any operation past a momentary io hiccup. The facade’s own
Io/NotARepository/
BareRepository/
WorktreeNotFound variants are never transient.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Whether the underlying CLI binary (git/jj) wasn’t found — a setup
problem (the tool isn’t installed or isn’t on PATH), not a repository or
usage error. Delegates to processkit::Error::is_not_found; lets a caller
surface a “please install git/jj” hint instead of a raw spawn failure.
Sourcepub fn is_invalid_input(&self) -> bool
pub fn is_invalid_input(&self) -> bool
Whether this is an input rejection — a value the facade refused before
spawning, because it was a bad argument: a flag-like/empty/NUL-containing
value in a guarded positional slot (via the wrapper guards), or a facade-level
precondition on the arguments (an empty file set for commit_paths, removing
the main workspace). This is a caller bug, distinct from a real IO or
backend failure — a language binding maps it to a ValueError. Completes the
is_* classifier family alongside is_not_found.
Sourcepub fn is_resource_not_found(&self) -> bool
pub fn is_resource_not_found(&self) -> bool
Whether a resource the operation named doesn’t exist — currently a
worktree/workspace lookup by path that matched no attached worktree
(WorktreeNotFound). Distinct from
is_not_found, which means the git/jj binary
wasn’t found (a setup problem), and from is_invalid_input
(a bad argument). A binding maps this to a NotFoundError.
Note the backend asymmetry: only the jj backend raises the typed
WorktreeNotFound; git’s missing-worktree removal surfaces as a generic
backend Exit, which this does not classify. (Likewise the main-workspace
refusal that is_invalid_input recognizes is a
typed error only on jj.)
Sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
Whether this is an Unsupported action — the caller
asked for something the repository’s current in-progress state cannot
honour (e.g. continue_in_progress during a git bisect). Distinct from
is_invalid_input (a bad argument): the
argument was fine, the state just has no such step. Mirrors
vcs_forge::Error::is_unsupported, so the two facades name the concept the
same way for a language binding.
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()