fix(autoUpdate): improve error handling and UI reset during update process

This commit is contained in:
MasterAcnolo
2026-09-29 17:20:42 +02:00
parent ac1d74ff23
commit 1937738ab8
3 changed files with 31 additions and 9 deletions

View File

@@ -112,6 +112,7 @@ function initAutoUpdater(mainWindow) {
}
logger.error("Auto update error:", err);
mainWindow?.webContents.send("update-error", msg);
});
checkForUpdates();
@@ -122,6 +123,8 @@ function initAutoUpdater(mainWindow) {
* Separated from init for reusability and testability.
*/
async function checkForUpdates() {
// If app is was installed from SNAP or Flatpak.
if (process.env.SNAP || process.env.FLATPAK_ID) return;
if (!require("electron").app.isPackaged) return;
@@ -141,6 +144,7 @@ async function downloadUpdate() {
await autoUpdater.downloadUpdate();
} catch (err) {
logger.error("Download failed:", err.message);
throw err;
}
}