httpd: Better error output from git backend
This commit is contained in:
parent
4fb5f6c172
commit
8ea9921765
|
|
@ -1,3 +1,5 @@
|
|||
use std::process::ExitStatus;
|
||||
|
||||
use axum::http;
|
||||
use axum::response::{IntoResponse, Response};
|
||||
|
||||
|
|
@ -21,8 +23,12 @@ pub enum GitError {
|
|||
Id(#[from] radicle::identity::IdError),
|
||||
|
||||
/// Git backend error.
|
||||
#[error("backend error")]
|
||||
Backend,
|
||||
#[error("git-http-backend: exited with code {0}")]
|
||||
BackendExited(ExitStatus),
|
||||
|
||||
/// Git backend error.
|
||||
#[error("git-http-backend: invalid header returned: {0:?}")]
|
||||
BackendHeader(String),
|
||||
|
||||
/// HeaderName error.
|
||||
#[error(transparent)]
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ async fn git_http_backend(
|
|||
.or_insert_with(Vec::new)
|
||||
.push(value.to_string());
|
||||
} else {
|
||||
return Err(Error::Backend);
|
||||
return Err(Error::BackendHeader(line));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +191,10 @@ async fn git_http_backend(
|
|||
Ok((status, headers, body))
|
||||
}
|
||||
Ok(output) => {
|
||||
tracing::error!("git-http-backend: exited with code {}", output.status);
|
||||
|
||||
if let Ok(output) = std::str::from_utf8(&output.stderr) {
|
||||
tracing::error!("git-http-backend: stderr: {}", output.trim_end());
|
||||
}
|
||||
Err(Error::Backend)
|
||||
Err(Error::BackendExited(output.status))
|
||||
}
|
||||
Err(err) => {
|
||||
panic!("failed to wait for git-http-backend: {err}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue