show error modal when update failed
This commit is contained in:
parent
73fb9464d2
commit
1de9fce504
6
app.js
6
app.js
|
@ -82,6 +82,12 @@ const run = () => {
|
|||
type: "update-complete"
|
||||
})
|
||||
});
|
||||
downloadTask.on('error', () => {
|
||||
mainWindow.webContents.send('status_update', {
|
||||
type: "error",
|
||||
message: "An error occured while updating."
|
||||
});
|
||||
});
|
||||
|
||||
} else
|
||||
mainWindow.webContents.send('status_update', {
|
||||
|
|
|
@ -98,14 +98,14 @@ async function filesThatNeedUpdate(osuPath, updateFiles) {
|
|||
fileName,
|
||||
fileURL
|
||||
})
|
||||
// console.log("hashes are not matching", `(${existingFileMD5} - ${fileHash})`);
|
||||
//console.log("hashes are not matching", `(${existingFileMD5} - ${fileHash})`);
|
||||
}
|
||||
} else {
|
||||
filesToDownload.push({
|
||||
fileName,
|
||||
fileURL
|
||||
});
|
||||
// console.log("new file " + fileName);
|
||||
//console.log("new file " + fileName);
|
||||
}
|
||||
}
|
||||
return filesToDownload;
|
||||
|
@ -116,6 +116,7 @@ async function downloadUpdateFiles(osuPath, filesToUpdate) {
|
|||
let completedIndex = 0;
|
||||
filesToUpdate.forEach(async (fileToUpdate) => {
|
||||
const filePath = path.join(osuPath, fileToUpdate.fileName);
|
||||
console.log(filePath);
|
||||
if (await fu.existsAsync(filePath))
|
||||
await fs.promises.rm(filePath);
|
||||
|
||||
|
@ -128,6 +129,10 @@ async function downloadUpdateFiles(osuPath, filesToUpdate) {
|
|||
if (completedIndex >= filesToUpdate.length)
|
||||
eventEmitter.emit('completed');
|
||||
});
|
||||
fileDownload.on('error', (err) => {
|
||||
console.log(err);
|
||||
eventEmitter.emit('error');
|
||||
});
|
||||
|
||||
fileDownload.start().catch(err => console.error(err));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user