Graceful renames, better errors in updater

This commit is contained in:
Fedor Indutny 2022-03-28 12:05:44 -07:00 committed by GitHub
parent a0ae7c1aa2
commit acda5b2cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 42 deletions

View file

@ -29,26 +29,12 @@ export class MacOSUpdater extends Updater {
} catch (error) {
const readOnly = 'Cannot update while running on a read-only volume';
const message: string = error.message || '';
const mainWindow = this.getMainWindow();
if (mainWindow && message.includes(readOnly)) {
logger.info('downloadAndInstall: showing read-only dialog...');
mainWindow.webContents.send(
'show-update-dialog',
DialogType.MacOS_Read_Only
);
} else if (mainWindow) {
logger.info(
'downloadAndInstall: showing general update failure dialog...'
);
mainWindow.webContents.send(
'show-update-dialog',
DialogType.Cannot_Update
);
} else {
logger.warn(
'downloadAndInstall: no mainWindow, cannot show update dialog'
);
}
this.markCannotUpdate(
error,
message.includes(readOnly)
? DialogType.MacOS_Read_Only
: DialogType.Cannot_Update
);
throw error;
}