Skip to content

Commit

Permalink
fix: Catch error if backup fails
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkoelle committed Jul 1, 2021
1 parent 73acc6d commit 186797b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ export default class Backup {
: `${Path.basename(this.path)}.bak${new Date().toISOString()}`;
const dest = Path.join(Backup.backupDir, fileName);

fs.copyFileSync(this.path, dest);
try {
fs.copyFileSync(this.path, dest);
} catch (err) {
if (this.webContents !== undefined) {
this.webContents.send(BackupIPC.BACKUP_FAILED, err);
}
}

if (this.webContents !== undefined) {
// TODO: check if backup was really successful
Expand Down

0 comments on commit 186797b

Please sign in to comment.