mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(electron): swallow auto-updater check rejection to avoid unhandled rejection (#3339)
checkForUpdates() is fired unawaited from a setTimeout at startup. The underlying autoUpdater.checkForUpdates() rejects on a 404 (release update manifest not published yet), offline, or rate-limit — and the uncaught rejection surfaced as an "Unhandled Rejection", which the packaged-app smoke test treats as fatal (failed the macOS-intel v3.8.13 build; passed elsewhere only by timing race). The autoUpdater "error" event still notifies the user; wrap the await so the promise rejection never escapes. Adds a regression test.
This commit is contained in:
committed by
GitHub
parent
df2379053e
commit
630baa6c18
@@ -266,7 +266,18 @@ async function checkForUpdates(silent = false) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
await autoUpdater.checkForUpdates();
|
||||
// Update-check failures (404 when the release manifest isn't published yet,
|
||||
// offline, rate-limited) are surfaced to the user via the autoUpdater "error"
|
||||
// event handler. The promise returned by checkForUpdates() ALSO rejects on
|
||||
// those, so it must be caught here — the startup check (line ~928) fires it
|
||||
// unawaited inside a setTimeout, and an uncaught rejection there becomes an
|
||||
// "Unhandled Rejection" that the packaged-app smoke test treats as fatal.
|
||||
try {
|
||||
await autoUpdater.checkForUpdates();
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
console.warn("[Electron] Update check failed (non-fatal):", msg);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadUpdate() {
|
||||
|
||||
Reference in New Issue
Block a user