fix: use unlinkIfExists

- handle failed migration copy issue separately
This commit is contained in:
18alantom
2022-08-30 18:13:42 +05:30
parent 65a91e6f86
commit a8e681b973
7 changed files with 100 additions and 27 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export default function registerAutoUpdaterListeners(main: Main) {
return;
}
main.mainWindow!.webContents.send(IPC_CHANNELS.MAIN_PROCESS_ERROR, error);
main.mainWindow!.webContents.send(IPC_CHANNELS.LOG_MAIN_PROCESS_ERROR, error);
dialog.showErrorBox(
'Update Error: ',
error == null ? 'unknown' : (error.stack || error).toString()
+16 -3
View File
@@ -1,5 +1,5 @@
import { app } from 'electron';
import { IPC_CHANNELS } from 'utils/messages';
import { CUSTOM_EVENTS, IPC_CHANNELS } from 'utils/messages';
import { Main } from '../main';
export default function registerProcessListeners(main: Main) {
@@ -17,12 +17,25 @@ export default function registerProcessListeners(main: Main) {
}
}
process.on(CUSTOM_EVENTS.MAIN_PROCESS_ERROR, (error) => {
main.mainWindow!.webContents.send(
IPC_CHANNELS.LOG_MAIN_PROCESS_ERROR,
error
);
});
process.on('unhandledRejection', (error) => {
main.mainWindow!.webContents.send(IPC_CHANNELS.MAIN_PROCESS_ERROR, error);
main.mainWindow!.webContents.send(
IPC_CHANNELS.LOG_MAIN_PROCESS_ERROR,
error
);
});
process.on('uncaughtException', (error) => {
main.mainWindow!.webContents.send(IPC_CHANNELS.MAIN_PROCESS_ERROR, error);
main.mainWindow!.webContents.send(
IPC_CHANNELS.LOG_MAIN_PROCESS_ERROR,
error
);
setTimeout(() => process.exit(1), 10000);
});
}