MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / handleFatalSidecarFailure

Function handleFatalSidecarFailure

apps/desktop/src/main/index.ts:1065–1104  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

1063// here, the boot-time update check never runs (it sits after a successful
1064// sidecar start), so a broken app could never self-update its way out.
1065const handleFatalSidecarFailure = async (error: unknown) => {
1066 showCrashScreen();
1067 if (app.isPackaged) {
1068 // Install whatever finishes downloading by the time the user quits the
1069 // failure dialog; if it downloads while the dialog is open, the regular
1070 // 'update-downloaded' prompt offers an immediate restart instead.
1071 const autoInstallPlan = planFatalAutoInstallOnQuit({
1072 packaged: true,
1073 retryAfterReset: false,
1074 });
1075 if (autoInstallPlan.enableDuringFailure) autoUpdater.autoInstallOnAppQuit = true;
1076 void runUpdateCheck({ alertOnFail: false, trigger: "boot" });
1077 }
1078 // oxlint-disable-next-line executor/no-instanceof-error, executor/no-unknown-error-message -- boundary: sidecar startup failures arrive as plain Node errors and render in a native dialog
1079 const detail = error instanceof Error ? (error.stack ?? error.message) : String(error);
1080 const { response } = await dialog.showMessageBox({
1081 type: "error",
1082 title: "Executor failed to start",
1083 message: "The local Executor server crashed during startup.",
1084 detail: `${detail.slice(0, 1800)}\n\nFull log: ${log.transports.file.getFile().path}`,
1085 buttons: ["Quit", "Reset data and retry…"],
1086 defaultId: 0,
1087 cancelId: 0,
1088 });
1089 // Damaged executor state (failed migration, corrupt SQLite) makes startup
1090 // fail forever — updating can't fix it. Offer the move-aside reset and one
1091 // immediate retry. Returns true when boot should be attempted again.
1092 const retryAfterReset = response === 1 && (await confirmResetState());
1093 const autoInstallPlan = planFatalAutoInstallOnQuit({
1094 packaged: app.isPackaged,
1095 retryAfterReset,
1096 });
1097 if (retryAfterReset) {
1098 if (autoInstallPlan.restoreAfterRecovery) autoUpdater.autoInstallOnAppQuit = false;
1099 const { backupDir } = resetExecutorState();
1100 await announceBackup(backupDir);
1101 return true;
1102 }
1103 return false;
1104};
1105
1106const installApplicationMenu = () => {
1107 const isMac = process.platform === "darwin";

Callers 1

bootFunction · 0.85

Calls 6

confirmResetStateFunction · 0.90
resetExecutorStateFunction · 0.90
announceBackupFunction · 0.90
showCrashScreenFunction · 0.85
runUpdateCheckFunction · 0.85

Tested by

no test coverage detected