From 4b583a035397d1b52fb206fab7f1cb9eb594a53c Mon Sep 17 00:00:00 2001 From: Amolith Date: Mon, 2 Mar 2026 09:33:45 -0700 Subject: [PATCH] Surface serde error detail in sync handshake failure --- src/cmd/sync.rs | 8 ++++++-- src/main.rs | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cmd/sync.rs b/src/cmd/sync.rs index 78366127c03574f17f7928396ac1df8224fbd26b..48e8400fb90db61498ce9424fce4c390b2eb27d5 100644 --- a/src/cmd/sync.rs +++ b/src/cmd/sync.rs @@ -93,7 +93,9 @@ pub async fn exchange(store: &db::Store, mut wormhole: Wormhole) -> Result() .await .context("failed to receive handshake")? - .context("peer sent invalid handshake JSON")?; + .context( + "peer sent incompatible handshake (are both sides running the same version of td?)", + )?; let their_vv = match &their_handshake { SyncHandshake::Sync { @@ -209,7 +211,9 @@ async fn bootstrap_exchange( .receive_json::() .await .context("failed to receive handshake")? - .context("peer sent invalid handshake JSON")?; + .context( + "peer sent incompatible handshake (are both sides running the same version of td?)", + )?; let project_name = match their_handshake { SyncHandshake::Sync { project_name, .. } => project_name, diff --git a/src/main.rs b/src/main.rs index abd9fa2ff5475f670f3e65ca1c18bdf77e11a628..b5c7f281ee0d4d2ade89515c47645821d69d9dc2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,9 @@ fn main() { if let Err(e) = yatd::run() { let c = yatd::color::stderr_theme(); eprintln!("{}error:{} {e}", c.red, c.reset); + for cause in e.chain().skip(1) { + eprintln!("{}caused by:{} {cause}", c.red, c.reset); + } process::exit(1); } }