#[non_exhaustive]pub enum Error {
Spawn {
program: String,
source: Error,
},
Exit {
program: String,
code: i32,
stdout: String,
stderr: String,
},
Timeout {
program: String,
timeout: Duration,
},
Parse {
program: String,
message: String,
},
Io(Error),
}Expand description
Errors produced when launching or running a child process.
Spawn failures, a non-zero exit (Exit), timeouts, and IO
errors fold into one structured enum, so callers can pattern-match on the
failure mode instead of parsing strings.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Spawn
The child process could not be started (binary not found, permission denied, …).
Exit
The process ran to completion but exited with a non-zero status.
Produced by the ensure_success helpers; the raw exit code is otherwise
reported without erroring (a non-zero exit is not inherently a failure).
Both captured streams are carried (each truncated to 4 KiB): git/jj
write decisive diagnostics to stdout on failure (CONFLICT (content): …, nothing to commit, working tree clean), so a caller building a
user-facing message wants stdout as a fallback when stderr is empty — see
diagnostic.
Fields
Timeout
The process exceeded its configured timeout and was killed.
Parse
The process succeeded but its output could not be parsed into the
expected shape (e.g. malformed --json). Produced by the fallible-parse
helpers on CliClient.
Io(Error)
An IO error occurred while driving the process (reading a pipe, writing stdin, waiting for exit).
Implementations§
Source§impl Error
impl Error
Sourcepub fn diagnostic(&self) -> Option<&str>
pub fn diagnostic(&self) -> Option<&str>
The best human-facing message for a failed run: captured standard error
if it carries text, otherwise the captured standard output (where git
puts CONFLICT … and git commit puts nothing to commit). Returns
None when there is no captured output to show — a silent Exit
(both streams blank) or any non-Exit variant (Spawn,
Timeout, Parse, Io) —
so a caller can fall back to the Display message.
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()