Skip to content

Commit a75ae8f

Browse files
committed
improve error handling
1 parent ca834a6 commit a75ae8f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

asyncgit/src/sync/hooks.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ impl From<git2_hooks::HookResult> for HookResult {
3232
if response.is_successful() {
3333
Self::Ok
3434
} else {
35-
Self::NotOk(format!(
36-
"{}{}",
37-
response.stdout, response.stderr
38-
))
35+
Self::NotOk(if response.stderr.is_empty() {
36+
response.stdout
37+
} else if response.stdout.is_empty() {
38+
response.stderr
39+
} else {
40+
format!(
41+
"{}\n{}",
42+
response.stdout, response.stderr
43+
)
44+
})
3945
}
4046
}
4147
}

0 commit comments

Comments
 (0)