(error: unknown)
| 1021 | // here, the boot-time update check never runs (it sits after a successful |
| 1022 | // sidecar start), so a broken app could never self-update its way out. |
| 1023 | const handleFatalSidecarFailure = async (error: unknown) => { |
| 1024 | showCrashScreen(); |
| 1025 | if (app.isPackaged) { |
| 1026 | // Install whatever finishes downloading by the time the user quits the |
| 1027 | // failure dialog; if it downloads while the dialog is open, the regular |
| 1028 | // 'update-downloaded' prompt offers an immediate restart instead. |
| 1029 | const autoInstallPlan = planFatalAutoInstallOnQuit({ |
| 1030 | packaged: true, |
| 1031 | retryAfterReset: false, |
| 1032 | }); |
| 1033 | if (autoInstallPlan.enableDuringFailure) autoUpdater.autoInstallOnAppQuit = true; |
| 1034 | void runUpdateCheck({ alertOnFail: false, trigger: "boot" }); |
| 1035 | } |
| 1036 | // 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 |
| 1037 | const detail = error instanceof Error ? (error.stack ?? error.message) : String(error); |
| 1038 | const { response } = await dialog.showMessageBox({ |
| 1039 | type: "error", |
| 1040 | title: "Executor failed to start", |
| 1041 | message: "The local Executor server crashed during startup.", |
| 1042 | detail: `${detail.slice(0, 1800)}\n\nFull log: ${log.transports.file.getFile().path}`, |
| 1043 | buttons: ["Quit", "Reset data and retry…"], |
| 1044 | defaultId: 0, |
| 1045 | cancelId: 0, |
| 1046 | }); |
| 1047 | // Damaged executor state (failed migration, corrupt SQLite) makes startup |
| 1048 | // fail forever — updating can't fix it. Offer the move-aside reset and one |
| 1049 | // immediate retry. Returns true when boot should be attempted again. |
| 1050 | const retryAfterReset = response === 1 && (await confirmResetState()); |
| 1051 | const autoInstallPlan = planFatalAutoInstallOnQuit({ |
| 1052 | packaged: app.isPackaged, |
| 1053 | retryAfterReset, |
| 1054 | }); |
| 1055 | if (retryAfterReset) { |
| 1056 | if (autoInstallPlan.restoreAfterRecovery) autoUpdater.autoInstallOnAppQuit = false; |
| 1057 | const { backupDir } = resetExecutorState(); |
| 1058 | await announceBackup(backupDir); |
| 1059 | return true; |
| 1060 | } |
| 1061 | return false; |
| 1062 | }; |
| 1063 | |
| 1064 | const installApplicationMenu = () => { |
| 1065 | const isMac = process.platform === "darwin"; |
no test coverage detected