Skip to main content

WorktreeError

Enum WorktreeError 

Source
#[non_exhaustive]
pub enum WorktreeError { NotAGitRepo, GitCommand { op: String, stderr: String, }, PathExists(PathBuf), BaseRefUnresolved { attempted: String, }, InvalidBranchName(String), RootOutsideRepo(PathBuf), Io(Error), QuotaExceeded { current: usize, max: usize, }, }
Expand description

All errors that zeph-worktree can produce.

Every variant is designed so that the Display message is safe to show to the user; raw git stderr is kept in WorktreeError::GitCommand’s stderr field and must only be logged at DEBUG level — never forwarded to the user.

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.
§

NotAGitRepo

The working directory is not inside a git repository.

§

GitCommand

A git sub-command exited with a non-zero status.

op names the operation (e.g. "fetch", "worktree add"). stderr is raw git output — log at DEBUG, never surface to the user.

Fields

§op: String

The git operation that failed (e.g. "fetch", "worktree add").

§stderr: String

Raw stderr from git — for diagnostic logging only.

§

PathExists(PathBuf)

The computed worktree path already exists on disk.

§

BaseRefUnresolved

The default branch could not be resolved.

Emitted when config.default_branch is empty and git symbolic-ref refs/remotes/origin/HEAD fails.

Fields

§attempted: String

Description of what was attempted before giving up.

§

InvalidBranchName(String)

The subagent_id value contains characters that are not allowed in a git branch component.

§

RootOutsideRepo(PathBuf)

The canonicalised worktree root resolves to a path outside the repository.

§

Io(Error)

An I/O error propagated from the OS or std::fs.

§

QuotaExceeded

A create() call was refused because worktree.max_worktrees would be reached or exceeded.

current is the number of git-registered secondary worktrees under root at the time of the check (including worktrees owned by other, concurrently running zeph sessions); max is the configured max_worktrees limit. This is a soft, best-effort cap — see WorktreeManager::create’s doc comment for the TOCTOU caveat under concurrent sessions.

Fields

§current: usize

Number of git-registered secondary worktrees under root at check time.

§max: usize

The configured worktree.max_worktrees limit.

Trait Implementations§

Source§

impl Debug for WorktreeError

Source§

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

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

impl Display for WorktreeError

Source§

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

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

impl Error for WorktreeError

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 WorktreeError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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