fix: show me what they say when rejecting sign :(

This commit is contained in:
əlemi 2024-03-27 00:24:14 +01:00
parent a2f77fa6fb
commit f2513f30c8
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -147,11 +147,15 @@ async fn deliver(key: &PKey<Private>, to: &str, from: &str, payload: serde_json:
.header(USER_AGENT, format!("upub+{VERSION} ({domain})")) // TODO put instance admin email .header(USER_AGENT, format!("upub+{VERSION} ({domain})")) // TODO put instance admin email
.body(payload) .body(payload)
.send() .send()
.await?
.error_for_status()?
.text()
.await?; .await?;
tracing::info!("server answered with OK '{res}'");
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(()) Ok(())
}
} }