#[non_exhaustive]pub enum Error {
NotARepository(PathBuf),
WorktreeNotFound(PathBuf),
Io(Error),
Vcs(Error),
}Expand description
An error from a Repo operation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotARepository(PathBuf)
Repo::open found no .git/.jj from the start dir
up to the filesystem root.
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.
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/
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.)
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()