Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
recent_projects: Improve user facing error messages on connection failure (#42083)
Lukas Wirth28d7c37b0d43
diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rsindex c727a94c2d5..561f4f3ea37 100644--- a/crates/auto_update/src/auto_update.rs+++ b/crates/auto_update/src/auto_update.rs@@ -406,6 +406,7 @@ impl AutoUpdater {arch: &str,release_channel: ReleaseChannel,version: Option<SemanticVersion>,+ set_status: impl Fn(&str, &mut AsyncApp) + Send + 'static,cx: &mut AsyncApp,) -> Result<PathBuf> {let this = cx.update(|cx| {@@ -415,6 +416,7 @@ impl AutoUpdater {.context("auto-update not initialized")})??;+ set_status("Fetching remote server release", cx);let release = Self::get_release(&this,"zed-remote-server",@@ -439,6 +441,7 @@ impl AutoUpdater {"downloading zed-remote-server {os} {arch} version {}",release.version);+ set_status("Downloading remote server", cx);download_remote_server_binary(&version_path, release, client, cx).await?;}diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rsindex c34ed69288e..4f714b9b451 100644--- a/crates/markdown/src/markdown.rs+++ b/crates/markdown/src/markdown.rs@@ -1215,7 +1215,7 @@ impl Element for MarkdownElement {}MarkdownEvent::SoftBreak => builder.push_text(" ", range.clone()),MarkdownEvent::HardBreak => builder.push_text("\n", range.clone()),- _ => log::error!("unsupported markdown event {:?}", event),+ _ => log::debug!("unsupported markdown event {:?}", event),}}let mut rendered_markdown = builder.build();diff --git a/crates/recent_projects/src/remote_connections.rs b/crates/recent_projects/src/remote_connections.rsindex 54d87350ff3..82fa7272328 100644--- a/crates/recent_projects/src/remote_connections.rs+++ b/crates/recent_projects/src/remote_connections.rs@@ -482,12 +482,14 @@ impl remote::RemoteClientDelegate for RemoteClientDelegate {version: Option<SemanticVersion>,cx: &mut AsyncApp,) -> Task<anyhow::Result<PathBuf>> {+ let this = self.clone();cx.spawn(async move |cx| {AutoUpdater::download_remote_server_release(platform.os,platform.arch,release_channel,version,+ move |status, cx| this.set_status(Some(status), cx),cx,).await@@ -659,7 +661,7 @@ pub async fn open_remote_project(}}).ok();- log::error!("Failed to open project: {e:?}");+ log::error!("Failed to open project: {e:#}");let response = window.update(cx, |_, window, cx| {window.prompt(@@ -668,7 +670,7 @@ pub async fn open_remote_project(RemoteConnectionOptions::Ssh(_) => "Failed to connect over SSH",RemoteConnectionOptions::Wsl(_) => "Failed to connect to WSL",},- Some(&e.to_string()),+ Some(&format!("{e:#}")),&["Retry", "Cancel"],cx,)@@ -715,7 +717,7 @@ pub async fn open_remote_project(match opened_items {Err(e) => {- log::error!("Failed to open project: {e:?}");+ log::error!("Failed to open project: {e:#}");let response = window.update(cx, |_, window, cx| {window.prompt(@@ -724,7 +726,7 @@ pub async fn open_remote_project(RemoteConnectionOptions::Ssh(_) => "Failed to connect over SSH",RemoteConnectionOptions::Wsl(_) => "Failed to connect to WSL",},- Some(&e.to_string()),+ Some(&format!("{e:#}")),&["Retry", "Cancel"],cx,)diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rsindex 1bfa5e640d9..d91a0d742cd 100644--- a/crates/remote/src/transport/wsl.rs+++ b/crates/remote/src/transport/wsl.rs@@ -210,8 +210,6 @@ impl WslRemoteConnection {return Ok(dst_path);}- delegate.set_status(Some("Installing remote server"), cx);-let wanted_version = match release_channel {ReleaseChannel::Nightly | ReleaseChannel::Dev => None,_ => Some(cx.update(|cx| AppVersion::global(cx))?),@@ -242,7 +240,7 @@ impl WslRemoteConnection {delegate: &Arc<dyn RemoteClientDelegate>,cx: &mut AsyncApp,) -> Result<()> {- delegate.set_status(Some("Uploading remote server to WSL"), cx);+ delegate.set_status(Some("Uploading remote server"), cx);if let Some(parent) = dst_path.parent() {let parent = parent.display(PathStyle::Posix);