Fail better when workspace restoration all fails (#50330) (cherry-pick to preview) (#50334)

zed-zippy[bot] and Conrad Irwin created

Cherry-pick of #50330 to preview

----
Release Notes:

- Fixed a bug that caused Zed to appear not to open if your workspaces
failed to restore

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>

Change summary

crates/zed/src/main.rs | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

Detailed changes

crates/zed/src/main.rs 🔗

@@ -1393,7 +1393,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,
                                 )
                             });
@@ -1405,11 +1405,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 there
             if !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)) {