From f2513f30c8273838917f8f1b5e6f2a26fc9d4fbc Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 27 Mar 2024 00:24:14 +0100 Subject: [PATCH] fix: show me what they say when rejecting sign :( --- src/dispatcher.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dispatcher.rs b/src/dispatcher.rs index e99c379f..809b18ff 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -147,11 +147,15 @@ async fn deliver(key: &PKey, to: &str, from: &str, payload: serde_json: .header(USER_AGENT, format!("upub+{VERSION} ({domain})")) // TODO put instance admin email .body(payload) .send() - .await? - .error_for_status()? - .text() .await?; - tracing::info!("server answered with OK '{res}'"); - Ok(()) + + let status = res.status(); + let txt = res.text().await?; + tracing::info!("delivery answer: {txt}"); + if status.is_client_error() || status.is_server_error() { + Err(UpubError::Status(axum::http::StatusCode::from_u16(status.as_u16()).unwrap())) + } else { + Ok(()) + } }