From 548b28de69335793d31d0c2bcd0baf1e3050e818 Mon Sep 17 00:00:00 2001 From: John Detter <4099508+jdetter@users.noreply.github.com> Date: Wed, 29 Apr 2026 21:50:31 -0500 Subject: [PATCH] client-api: route GetLeaderHostError through Into The two leader() call sites in database.rs and subscribe.rs were piping GetLeaderHostError through log_and_500, which logs every variant at error level and forces a 500 response. GetLeaderHostError already implements Into with proper status codes (503 for Suspended/Bootstrapping/NoLeader/NoNodeId/ControlConnection, 404 for NoSuchDatabase, 500 for LaunchError/Misdirected), and standalone already uses ?-propagation directly. Match that pattern so suspended databases no longer log at error level and return the correct 503 status. --- crates/client-api/src/routes/database.rs | 2 +- crates/client-api/src/routes/subscribe.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/client-api/src/routes/database.rs b/crates/client-api/src/routes/database.rs index cacf7ab0557..e1464814656 100644 --- a/crates/client-api/src/routes/database.rs +++ b/crates/client-api/src/routes/database.rs @@ -292,7 +292,7 @@ async fn find_leader_and_database( NO_SUCH_DATABASE })?; - let leader = worker_ctx.leader(database.id).await.map_err(log_and_500)?; + let leader = worker_ctx.leader(database.id).await.map_err(Into::into)?; Ok((leader, database)) } diff --git a/crates/client-api/src/routes/subscribe.rs b/crates/client-api/src/routes/subscribe.rs index 6602d34d9a5..e2131abfa31 100644 --- a/crates/client-api/src/routes/subscribe.rs +++ b/crates/client-api/src/routes/subscribe.rs @@ -202,7 +202,7 @@ where .map_err(log_and_500)? .ok_or(StatusCode::NOT_FOUND)?; - let leader = ctx.leader(database.id).await.map_err(log_and_500)?; + let leader = ctx.leader(database.id).await.map_err(Into::into)?; let identity_token = auth.creds.token().into();