From 325c857409708a3399ef487a97e96e573f9b4e1a Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 12:42:49 +0000 Subject: [PATCH] proto: Fix cloned errors losing all context (#43393) (cherry-pick to preview) (#43395) Cherry-pick of #43393 to preview ---- Release Notes: - N/A *or* Added/Fixed/Improved ... Co-authored-by: Lukas Wirth --- crates/proto/src/error.rs | 2 +- crates/remote/src/transport/ssh.rs | 2 +- crates/remote/src/transport/wsl.rs | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/proto/src/error.rs b/crates/proto/src/error.rs index c2fdfcf820..d83b0fc499 100644 --- a/crates/proto/src/error.rs +++ b/crates/proto/src/error.rs @@ -126,7 +126,7 @@ impl ErrorExt for anyhow::Error { if let Some(rpc_error) = self.downcast_ref::() { rpc_error.cloned() } else { - anyhow::anyhow!("{self}") + anyhow::anyhow!("{self:#}") } } } diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rs index 6244045d1e..fdf0f05ae6 100644 --- a/crates/remote/src/transport/ssh.rs +++ b/crates/remote/src/transport/ssh.rs @@ -1327,7 +1327,7 @@ fn build_command( let working_dir = RemotePathBuf::new(working_dir, ssh_path_style).to_string(); // shlex will wrap the command in single quotes (''), disabling ~ expansion, - // replace with with something that works + // replace with something that works const TILDE_PREFIX: &'static str = "~/"; if working_dir.starts_with(TILDE_PREFIX) { let working_dir = working_dir.trim_start_matches("~").trim_start_matches("/"); diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rs index c075e4fb12..7d4664ab84 100644 --- a/crates/remote/src/transport/wsl.rs +++ b/crates/remote/src/transport/wsl.rs @@ -251,11 +251,13 @@ impl WslRemoteConnection { let mkdir = self.shell_kind.prepend_command_prefix("mkdir"); self.run_wsl_command(&mkdir, &["-p", &parent]) .await - .map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?; + .context("Failed to create directory when uploading file")?; } let t0 = Instant::now(); - let src_stat = fs::metadata(&src_path).await?; + let src_stat = fs::metadata(&src_path) + .await + .with_context(|| format!("source path does not exist: {}", src_path.display()))?; let size = src_stat.len(); log::info!( "uploading remote server to WSL {:?} ({}kb)",