Skip to content

Commit 1ae369e

Browse files
committed
add more robust error handle
1 parent 174c64e commit 1ae369e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/chat-cli/src/cli/chat/checkpoint.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,15 @@ fn run_git(dir: &Path, with_work_tree: bool, args: &[&str]) -> Result<Output> {
394394
cmd.args(args);
395395

396396
let output = cmd.output()?;
397-
if !output.status.success() && !output.stderr.is_empty() {
398-
bail!(String::from_utf8_lossy(&output.stderr).to_string());
397+
if !output.status.success() {
398+
if !output.stderr.is_empty() {
399+
bail!("Git command failed: {}", String::from_utf8_lossy(&output.stderr));
400+
} else {
401+
bail!(
402+
"Git command failed with no error output. Command: git {}",
403+
args.join(" ")
404+
);
405+
}
399406
}
400407

401408
Ok(output)

0 commit comments

Comments
 (0)