Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fail better when workspace restoration all fails (#50330)
Conrad Irwin51dc09c861fe
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex f429c32df79..cfa339afc08 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -1398,7 +1398,7 @@ pub(crate) async fn restore_or_create_workspace(.update(cx, |multi_workspace, _, cx| {multi_workspace.workspace().update(cx, |workspace, cx| {workspace.show_toast(- Toast::new(NotificationId::unique::<()>(), message),+ Toast::new(NotificationId::unique::<()>(), message.clone()),cx,)});@@ -1410,11 +1410,23 @@ pub(crate) async fn restore_or_create_workspace(});// If we couldn't show a toast (no windows opened successfully),- // we've already logged the errors above, so the user can check logs+ // open a fallback empty workspace and show the error thereif !toast_shown {- log::error!(- "Failed to show notification for window restoration errors, because no workspace windows were available."- );+ log::error!("All workspace restorations failed. Opening fallback empty workspace.");+ cx.update(|cx| {+ workspace::open_new(+ Default::default(),+ app_state.clone(),+ cx,+ |workspace, _window, cx| {+ workspace.show_toast(+ Toast::new(NotificationId::unique::<()>(), message),+ cx,+ );+ },+ )+ })+ .await?;}}} else if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {