mirror of
https://github.com/astro/buzzrelay.git
synced 2024-11-21 19:51:00 +00:00
improve error output
This commit is contained in:
parent
8c431650e2
commit
a014477773
4 changed files with 4 additions and 3 deletions
|
@ -120,7 +120,7 @@ impl<'a> Endpoint<'a> {
|
|||
|
||||
let public_key = PublicKey::from_pem(remote_actor.public_key.pem.as_bytes())?;
|
||||
if ! (self.signature.verify(&public_key)?) {
|
||||
return Err(Error::SignatureFail);
|
||||
return Err(Error::SignatureFail(self.remote_actor_uri.clone()));
|
||||
}
|
||||
|
||||
Ok(remote_actor)
|
||||
|
|
|
@ -9,7 +9,7 @@ pub enum Error {
|
|||
#[error("Signature error")]
|
||||
Signature(#[from] Arc<sigh::Error>),
|
||||
#[error("Signature verification failure")]
|
||||
SignatureFail,
|
||||
SignatureFail(String),
|
||||
#[error("HTTP request error")]
|
||||
HttpReq(#[from] Arc<http::Error>),
|
||||
#[error("HTTP client error")]
|
||||
|
|
|
@ -138,6 +138,7 @@ async fn post_relay(
|
|||
Ok(remote_actor) => remote_actor,
|
||||
Err(e) => {
|
||||
track_request("POST", "relay", "bad_actor");
|
||||
tracing::error!("post_relay bad actor: {e:?}");
|
||||
return (
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Bad actor: {:?}", e)
|
||||
|
@ -160,6 +161,7 @@ async fn post_relay(
|
|||
Ok(action) => action,
|
||||
Err(e) => {
|
||||
track_request("POST", "relay", "bad_action");
|
||||
tracing::error!("post_relay bad action: {e:?}");
|
||||
return (
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Bad action: {:?}", e)
|
||||
|
|
|
@ -55,7 +55,6 @@ pub async fn send_raw(
|
|||
Ok(())
|
||||
} else {
|
||||
histogram!("relay_http_response_duration", t3 - t2, "res" => "err", "host" => host);
|
||||
tracing::error!("send_raw {} response HTTP {}", url, res.status());
|
||||
let response = res.text().await?;
|
||||
Err(Error::Response(response))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue