pub enum GitError {
InvalidCloneStrategy(String),
DirectoryNotGitRepo(String),
NoGitOutput,
Exec(ExecError, String),
Other(String),
}Expand description
Ported from errors.go’s sentinel errors, plus the exec-layer error
this crate’s Client methods wrap. Go’s %w wrapping of a sentinel
alongside arbitrary formatted context becomes an explicit enum
variant per call site; see individual Client methods in Phase 4.
Variants§
InvalidCloneStrategy(String)
Ported from ErrInvalidCloneStrategy.
DirectoryNotGitRepo(String)
Ported from ErrDirectoryNotGitRepo.
NoGitOutput
Ported from ErrNoGitOutput.
Exec(ExecError, String)
Ported from wrapped %w execution errors (result.Error), plus
result.CombinedOutput() – Go’s error message is
fmt.Errorf("...: %w: %s", result.Error, result.CombinedOutput()),
so the combined stdout/stderr is part of the message a caller sees,
not just the exec-layer error. Empty when the command produced no
output before failing (e.g. the binary itself was missing).
Other(String)
Ported from ad hoc fmt.Errorf wraps with no sentinel (e.g.
“creating parent directory: %w” over an os.MkdirAll I/O error).
Trait Implementations§
Source§impl Error for GitError
impl Error for GitError
1.30.0 · 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()
Source§impl From<ExecError> for GitError
For call sites with only an ExecError and no ExecResult to pull
combined output from (e.g. CommandRunner::check, which returns a
plain bool/ExecError with no captured stdout/stderr) – the
?-operator path is_git_repository uses. run_result_to_git_error
is the richer conversion for callers that do have an ExecResult.
impl From<ExecError> for GitError
For call sites with only an ExecError and no ExecResult to pull
combined output from (e.g. CommandRunner::check, which returns a
plain bool/ExecError with no captured stdout/stderr) – the
?-operator path is_git_repository uses. run_result_to_git_error
is the richer conversion for callers that do have an ExecResult.
Auto Trait Implementations§
impl Freeze for GitError
impl RefUnwindSafe for GitError
impl Send for GitError
impl Sync for GitError
impl Unpin for GitError
impl UnsafeUnpin for GitError
impl UnwindSafe for GitError
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more