Skip to content

Commit 95f4c48

Browse files
committed
Propagate error through the UI
1 parent 3300d81 commit 95f4c48

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

packages/compass/src/app/components/update-toasts.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ export function onAutoupdateStarted({ newVersion }: { newVersion: string }) {
105105
title: `Compass ${newVersion} is downloading`,
106106
});
107107
}
108-
export function onAutoupdateFailed() {
108+
export function onAutoupdateFailed(reason?: 'outdated-operating-system') {
109109
openToast(updateToastId, {
110110
variant: 'warning',
111111
title: 'Failed to download Compass update',
112-
description: 'Downloading a newer Compass version failed',
112+
description:
113+
reason === 'outdated-operating-system'
114+
? 'The version of your operating system is no longer supported.'
115+
: 'Downloading a newer Compass version failed',
113116
});
114117
}
115118
export function onAutoupdateSuccess({

packages/compass/src/app/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,12 @@ const app = {
371371
onAutoupdateStarted({ newVersion });
372372
}
373373
);
374-
ipcRenderer?.on('autoupdate:update-download-failed', onAutoupdateFailed);
374+
ipcRenderer?.on(
375+
'autoupdate:update-download-failed',
376+
(_, reason?: 'outdated-operating-system') => {
377+
onAutoupdateFailed(reason);
378+
}
379+
);
375380
ipcRenderer?.on(
376381
'autoupdate:update-download-success',
377382
(_, { newVersion }: { newVersion: string }) => {

packages/compass/src/main/auto-update-manager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,10 @@ const STATE_UPDATE: Record<
485485
[AutoUpdateManagerState.OutdatedOperatingSystem]: {
486486
nextStates: [AutoUpdateManagerState.UserPromptedManualCheck],
487487
enter: () => {
488-
ipcMain?.broadcast('autoupdate:outdated-operating-system');
488+
ipcMain?.broadcast(
489+
'autoupdate:update-download-failed',
490+
'outdated-operating-system'
491+
);
489492
log.info(
490493
mongoLogId(1_001_000_346),
491494
'AutoUpdateManager',

0 commit comments

Comments
 (0)