proto: Fix cloned errors losing all context (#43393)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-24 12:13:20 +00:00
committed by GitHub
parent f8729f6ea0
commit a0fa5d57c1
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ impl ErrorExt for anyhow::Error {
if let Some(rpc_error) = self.downcast_ref::<RpcError>() { if let Some(rpc_error) = self.downcast_ref::<RpcError>() {
rpc_error.cloned() rpc_error.cloned()
} else { } else {
anyhow::anyhow!("{self}") anyhow::anyhow!("{self:#}")
} }
} }
} }
+1 -1
View File
@@ -1327,7 +1327,7 @@ fn build_command(
let working_dir = RemotePathBuf::new(working_dir, ssh_path_style).to_string(); let working_dir = RemotePathBuf::new(working_dir, ssh_path_style).to_string();
// shlex will wrap the command in single quotes (''), disabling ~ expansion, // 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 = "~/"; const TILDE_PREFIX: &'static str = "~/";
if working_dir.starts_with(TILDE_PREFIX) { if working_dir.starts_with(TILDE_PREFIX) {
let working_dir = working_dir.trim_start_matches("~").trim_start_matches("/"); let working_dir = working_dir.trim_start_matches("~").trim_start_matches("/");
+4 -2
View File
@@ -251,11 +251,13 @@ impl WslRemoteConnection {
let mkdir = self.shell_kind.prepend_command_prefix("mkdir"); let mkdir = self.shell_kind.prepend_command_prefix("mkdir");
self.run_wsl_command(&mkdir, &["-p", &parent]) self.run_wsl_command(&mkdir, &["-p", &parent])
.await .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 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(); let size = src_stat.len();
log::info!( log::info!(
"uploading remote server to WSL {:?} ({}kb)", "uploading remote server to WSL {:?} ({}kb)",