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