add forgotten err object check for fs.unlink (#6972)
PTR committed
Apr 14, 2025 at 20:04 UTC
f4b17909fd4219789baf172f4e9f62019de2e153
1 file changed
+1
-1
db.js
+1
-1
@@ -3661,7 +3661,7 @@ module.exports.CreateDB = function (parent, func) {
3661
let mesg = 'Zipbackup failed (' + obj.backupStatus.toString(2).slice(-8) + '), deleting incomplete backup: ' + obj.newAutoBackupFile;
3662
if (func) { func(mesg) }
3663
else { parent.addServerWarning(mesg, true ) };
3664
- if (fs.existsSync(obj.newAutoBackupFile)) { fs.unlink(obj.newAutoBackupFile, function (err) { console.error('Failed to clean up backupfile: ' + err.message) }) };
3664
+ if (fs.existsSync(obj.newAutoBackupFile)) { fs.unlink(obj.newAutoBackupFile, function (err) { if (err) {console.error('Failed to clean up backupfile: ' + err.message)} }) };
3665
};
3666
if (obj.databaseType != DB_NEDB) {
3667
//remove dump archive file, because zipped and otherwise fills up