Skip to content

Commit 1983552

Browse files
authored
Merge pull request #2136 from Urgau/axum-hotfix
Hotfixes for axum migration
2 parents a66fe51 + c756ba8 commit 1983552

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/github/webhook.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ pub async fn webhook(
172172
return (StatusCode::BAD_REQUEST, "Payload must be UTF-8").into_response();
173173
};
174174

175+
tracing::info!(?event, ?payload);
176+
175177
match process_payload(event, payload, &ctx).await {
176178
Ok(true) => ("processed request",).into_response(),
177179
Ok(false) => ("ignored request",).into_response(),

src/zulip.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::handlers::Context;
1212
use crate::handlers::docs_update::docs_update;
1313
use crate::handlers::pr_tracking::get_assigned_prs;
1414
use crate::handlers::project_goals::{self, ping_project_goals_owners};
15-
use crate::utils::{AppError, pluralize};
15+
use crate::utils::pluralize;
1616
use crate::zulip::api::{MessageApiResponse, Recipient};
1717
use crate::zulip::client::ZulipClient;
1818
use crate::zulip::commands::{
@@ -107,7 +107,19 @@ pub async fn webhook(
107107
})
108108
.into_response(),
109109
Ok(Some(content)) => Json(Response { content }).into_response(),
110-
Err(e) => AppError::from(e).into_response(),
110+
Err(err) => {
111+
// We are mixing network errors and "logic" error (like clap errors)
112+
// so don't return a 500. Long term we should decouple those.
113+
114+
// Log the full error
115+
tracing::error!(?err);
116+
117+
// Reply with a 200 and reply only with outermost error
118+
Json(Response {
119+
content: err.to_string(),
120+
})
121+
.into_response()
122+
}
111123
}
112124
}
113125

0 commit comments

Comments
 (0)