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

Function handleFatalSidecarFailure

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

Source from the content-addressed store, hash-verified

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