recent_projects: Improve user facing error messages on connection failure (#42083)
cc https://github.com/zed-industries/zed/issues/42004 Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -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?;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user