From 3707d10fe185ccdb34f07b2119d9443b9a8607ca Mon Sep 17 00:00:00 2001 From: Noah Zalev Date: Sun, 11 Apr 2021 21:47:25 -0400 Subject: [PATCH] Register output error listener in autobackups --- db.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db.js b/db.js index d2d318be..3e3ac250 100644 --- a/db.js +++ b/db.js @@ -1802,6 +1802,7 @@ module.exports.CreateDB = function (parent, func) { setTimeout(function () { try { parent.fs.unlink(newBackupPath + '.archive', function () { }); } catch (ex) { console.log(ex); } }, 5000); }); output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.pipe(output); @@ -1846,6 +1847,7 @@ module.exports.CreateDB = function (parent, func) { setTimeout(function () { try { parent.fs.unlink(newBackupPath + '.sql', function () { }); } catch (ex) { console.log(ex); } }, 5000); }); output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.pipe(output); @@ -1867,6 +1869,7 @@ module.exports.CreateDB = function (parent, func) { } output.on('close', function () { obj.performingBackup = false; if (func) { func('Auto-backup completed.'); } obj.performCloudBackup(newAutoBackupPath + '.zip', func); }); output.on('end', function () { }); + output.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.on('warning', function (err) { console.log('Backup warning: ' + err); if (func) { func('Backup warning: ' + err); } }); archive.on('error', function (err) { console.log('Backup error: ' + err); if (func) { func('Backup error: ' + err); } }); archive.pipe(output);