Skip to content

Commit 28d7c37

Browse files
authored
recent_projects: Improve user facing error messages on connection failure (#42083)
cc #42004 Release Notes: - N/A *or* Added/Fixed/Improved ...
1 parent f6da987 commit 28d7c37

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

crates/auto_update/src/auto_update.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ impl AutoUpdater {
406406
arch: &str,
407407
release_channel: ReleaseChannel,
408408
version: Option<SemanticVersion>,
409+
set_status: impl Fn(&str, &mut AsyncApp) + Send + 'static,
409410
cx: &mut AsyncApp,
410411
) -> Result<PathBuf> {
411412
let this = cx.update(|cx| {
@@ -415,6 +416,7 @@ impl AutoUpdater {
415416
.context("auto-update not initialized")
416417
})??;
417418

419+
set_status("Fetching remote server release", cx);
418420
let release = Self::get_release(
419421
&this,
420422
"zed-remote-server",
@@ -439,6 +441,7 @@ impl AutoUpdater {
439441
"downloading zed-remote-server {os} {arch} version {}",
440442
release.version
441443
);
444+
set_status("Downloading remote server", cx);
442445
download_remote_server_binary(&version_path, release, client, cx).await?;
443446
}
444447

crates/markdown/src/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ impl Element for MarkdownElement {
12151215
}
12161216
MarkdownEvent::SoftBreak => builder.push_text(" ", range.clone()),
12171217
MarkdownEvent::HardBreak => builder.push_text("\n", range.clone()),
1218-
_ => log::error!("unsupported markdown event {:?}", event),
1218+
_ => log::debug!("unsupported markdown event {:?}", event),
12191219
}
12201220
}
12211221
let mut rendered_markdown = builder.build();

crates/recent_projects/src/remote_connections.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,14 @@ impl remote::RemoteClientDelegate for RemoteClientDelegate {
482482
version: Option<SemanticVersion>,
483483
cx: &mut AsyncApp,
484484
) -> Task<anyhow::Result<PathBuf>> {
485+
let this = self.clone();
485486
cx.spawn(async move |cx| {
486487
AutoUpdater::download_remote_server_release(
487488
platform.os,
488489
platform.arch,
489490
release_channel,
490491
version,
492+
move |status, cx| this.set_status(Some(status), cx),
491493
cx,
492494
)
493495
.await
@@ -659,7 +661,7 @@ pub async fn open_remote_project(
659661
}
660662
})
661663
.ok();
662-
log::error!("Failed to open project: {e:?}");
664+
log::error!("Failed to open project: {e:#}");
663665
let response = window
664666
.update(cx, |_, window, cx| {
665667
window.prompt(
@@ -668,7 +670,7 @@ pub async fn open_remote_project(
668670
RemoteConnectionOptions::Ssh(_) => "Failed to connect over SSH",
669671
RemoteConnectionOptions::Wsl(_) => "Failed to connect to WSL",
670672
},
671-
Some(&e.to_string()),
673+
Some(&format!("{e:#}")),
672674
&["Retry", "Cancel"],
673675
cx,
674676
)
@@ -715,7 +717,7 @@ pub async fn open_remote_project(
715717

716718
match opened_items {
717719
Err(e) => {
718-
log::error!("Failed to open project: {e:?}");
720+
log::error!("Failed to open project: {e:#}");
719721
let response = window
720722
.update(cx, |_, window, cx| {
721723
window.prompt(
@@ -724,7 +726,7 @@ pub async fn open_remote_project(
724726
RemoteConnectionOptions::Ssh(_) => "Failed to connect over SSH",
725727
RemoteConnectionOptions::Wsl(_) => "Failed to connect to WSL",
726728
},
727-
Some(&e.to_string()),
729+
Some(&format!("{e:#}")),
728730
&["Retry", "Cancel"],
729731
cx,
730732
)

crates/remote/src/transport/wsl.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ impl WslRemoteConnection {
210210
return Ok(dst_path);
211211
}
212212

213-
delegate.set_status(Some("Installing remote server"), cx);
214-
215213
let wanted_version = match release_channel {
216214
ReleaseChannel::Nightly | ReleaseChannel::Dev => None,
217215
_ => Some(cx.update(|cx| AppVersion::global(cx))?),
@@ -242,7 +240,7 @@ impl WslRemoteConnection {
242240
delegate: &Arc<dyn RemoteClientDelegate>,
243241
cx: &mut AsyncApp,
244242
) -> Result<()> {
245-
delegate.set_status(Some("Uploading remote server to WSL"), cx);
243+
delegate.set_status(Some("Uploading remote server"), cx);
246244

247245
if let Some(parent) = dst_path.parent() {
248246
let parent = parent.display(PathStyle::Posix);

0 commit comments

Comments
 (0)