Skip to main content

Error

Enum Error 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more