Skip to content

Commit 7c341d5

Browse files
RajivTSmeta-codesync[bot]
authored andcommitted
git_server: log full anyhow cause chain for RL Land Service diversion errors
Summary: A redirected RL Land Service push that fails inside the diversion path currently surfaces in scuba as a one-line summary with no underlying cause, because the five error-formatting sites in `write/rl_land_service_diversion.rs` use bare `{}` (anyhow Display) on `anyhow::Error` values. `{}` prints only the outermost message; `{:#}` (alternate Display) prints the full cause chain joined with `: `. This change matches the convention already established in the MRL service (`facebook/multi_repo_land_service/src/logging.rs`, which uses `{:#}` consistently for anyhow chain materialization). Three `error!` lines switch to `{:#}`. The `anyhow::bail!` and `.map_err(|e| anyhow::anyhow!(...))` sites switch to `.context(...)` / `.with_context(...)`, which preserves the underlying Thrift error as a structured source rather than collapsing it into a flat string. Both forms produce the same chain when later formatted with `{:#}` via `info.first_error()` in `git_server/src/scuba.rs`. No behaviour change beyond log/scuba string content. Sites that build error strings from typed Thrift fields (`LandResult::failure`, `BRANCH_NOT_ENABLED`'s `invalid_req.message`) and `info!` lines are intentionally unchanged. Design: `facebook/multi_repo_land_service/docs/plans/2026-05-06-anyhow-chain-logging-design.md` (Diff A). Reviewed By: YousefSalama Differential Revision: D104042935 fbshipit-source-id: 2d8245a9f40747bc010a586cfe735d0410bff0aa
1 parent 6a0bf98 commit 7c341d5

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

eden/mononoke/servers/git/git_server/src/write/rl_land_service_diversion.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub async fn fire_and_forget_submit_land(
188188
Ok(c) => c,
189189
Err(e) => {
190190
error!(
191-
"Emergency push for repo {}: failed to create RL Land Service client: {}",
191+
"Emergency push for repo {}: failed to create RL Land Service client: {:#}",
192192
repo_name, e,
193193
);
194194
return;
@@ -208,7 +208,7 @@ pub async fn fire_and_forget_submit_land(
208208
Ok(s) => s,
209209
Err(e) => {
210210
error!(
211-
"Emergency push for repo {}: failed to get service client: {}",
211+
"Emergency push for repo {}: failed to get service client: {:#}",
212212
repo_name, e,
213213
);
214214
return;
@@ -224,7 +224,7 @@ pub async fn fire_and_forget_submit_land(
224224
}
225225
Err(e) => {
226226
error!(
227-
"Emergency push for repo {}: RL Land Service submitLand failed (best-effort): {}",
227+
"Emergency push for repo {}: RL Land Service submitLand failed (best-effort): {:#}",
228228
repo_name, e,
229229
);
230230
}
@@ -357,11 +357,10 @@ pub async fn divert_to_rl_land_service(
357357
});
358358
}
359359
}
360-
anyhow::bail!(
361-
"RL Land Service submitLand failed for repo {}: {}",
362-
repo_name,
363-
e
364-
);
360+
return Err(e).context(format!(
361+
"RL Land Service submitLand failed for repo {}",
362+
repo_name
363+
));
365364
}
366365
};
367366

@@ -383,13 +382,15 @@ pub async fn divert_to_rl_land_service(
383382
..Default::default()
384383
};
385384

386-
let status_response = service.getLandStatus(&status_request).await.map_err(|e| {
387-
anyhow::anyhow!(
388-
"RL Land Service getLandStatus failed for repo {}: {}",
389-
repo_name,
390-
e
391-
)
392-
})?;
385+
let status_response = service
386+
.getLandStatus(&status_request)
387+
.await
388+
.with_context(|| {
389+
format!(
390+
"RL Land Service getLandStatus failed for repo {}",
391+
repo_name
392+
)
393+
})?;
393394

394395
match status_response.status {
395396
LandStatus::COMPLETED => {

0 commit comments

Comments
 (0)