MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / handleLinuxInstallFailure

Function handleLinuxInstallFailure

apps/desktop/src/main/updater.ts:429–473  ·  view source on GitHub ↗
(
  format: LinuxPackageFormat,
  file: string,
  error: unknown
)

Source from the content-addressed store, hash-verified

427}
428
429function handleLinuxInstallFailure(
430 format: LinuxPackageFormat,
431 file: string,
432 error: unknown
433): void {
434 const code = (error as { code?: string | number }).code
435 const hint = manualInstallHint(format, file)
436
437 // pkexec isn't installed (no graphical askpass available).
438 if (code === 'ENOENT') {
439 revealDownloadedPackage(file)
440 setUpdateState(
441 nextStateFromInfo(
442 'error',
443 lastInfo,
444 `Couldn't install automatically: pkexec (graphical sudo) isn't available on this system. The update was downloaded to ${file} — install it manually with: ${hint}, then reopen ZenNotes.`
445 )
446 )
447 return
448 }
449
450 // pkexec exits 126/127 when the auth dialog is dismissed or not authorized.
451 // Keep the update ready so the user can retry.
452 if (code === 126 || code === 127) {
453 setUpdateState(
454 nextStateFromInfo(
455 'downloaded',
456 lastInfo,
457 'Update install was canceled. Click “Install and Relaunch” to try again.'
458 )
459 )
460 return
461 }
462
463 // dpkg/apt (or rpm/pacman) failed.
464 revealDownloadedPackage(file)
465 const detail = error instanceof Error ? error.message.trim() : String(error)
466 setUpdateState(
467 nextStateFromInfo(
468 'error',
469 lastInfo,
470 `Update install failed: ${detail || 'unknown error'}. The package is at ${file} — you can install it manually with: ${hint}.`
471 )
472 )
473}

Callers 1

Calls 4

manualInstallHintFunction · 0.85
revealDownloadedPackageFunction · 0.85
setUpdateStateFunction · 0.85
nextStateFromInfoFunction · 0.85

Tested by

no test coverage detected