pub enum Error {
Show 13 variants
NotInRepo,
NoCurrentWorktree,
Ambiguous {
query: String,
candidates: Vec<String>,
},
NotFound {
query: String,
},
NothingSelected,
Usage(String),
Config {
file: String,
key: String,
reason: String,
},
Subprocess {
program: String,
stderr: String,
},
GhUnavailable(String),
AgentUnavailable(String),
Operation(String),
Io(Error),
Json(Error),
}Expand description
Errors produced by wt library operations.
Variants§
NotInRepo
The current directory is not inside a Git repository.
NoCurrentWorktree
There is no current worktree (e.g. a bare repository) but the command requires one.
Ambiguous
A query resolved to more than one worktree (spec exit code 3).
Fields
NotFound
A query matched no worktree (spec exit code 1).
NothingSelected
Nothing was selected, e.g. a cancelled picker (spec exit code 3).
Usage(String)
A usage or argument error (spec exit code 2).
Config
A configuration error, naming the file, key, and reason.
Fields
Subprocess
A subprocess (git, gh, or a code agent) failed; stderr is surfaced
verbatim.
Fields
The gh CLI is missing or unauthenticated.
No code-agent CLI is available (missing binary or failed to launch).
Operation(String)
An operation failed for the reason described by the message.
Io(Error)
An underlying I/O error.
Json(Error)
A JSON serialization or deserialization error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn exit_code(&self) -> u8
pub fn exit_code(&self) -> u8
The process exit code this error maps to (spec §12): 2 for usage
errors, 3 for ambiguous queries or nothing selected, 1 otherwise.
Sourcepub fn operation(message: impl Into<String>) -> Self
pub fn operation(message: impl Into<String>) -> Self
Builds an Error::Operation from anything string-like.
Sourcepub fn usage(message: impl Into<String>) -> Self
pub fn usage(message: impl Into<String>) -> Self
Builds an Error::Usage from anything string-like.
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()
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ErrorExt for T
impl<T> ErrorExt for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more