Improved error messages/handling for 2.18 migrations (#10608)
no-issue We do not want to throw errors for edgecases, so we lot a message telling the user to double check their settings.
This commit is contained in:
parent
a8debd8980
commit
406e7c04d2
@ -22,6 +22,11 @@ module.exports.up = (options) => {
|
||||
}, options);
|
||||
|
||||
return fs.readdir(dataPath).then(function (files) {
|
||||
return files;
|
||||
}).catch(function () {
|
||||
common.logging.warn(`Error reading ${dataPath} whilst trying to ensure boolean settings are correct. Please double check your settings after this upgrade`);
|
||||
return [];
|
||||
}).then(function (files) {
|
||||
const backups = files.filter(function (filename) {
|
||||
return backupFileRegex.test(filename);
|
||||
}).sort(function (a, b) {
|
||||
@ -40,7 +45,13 @@ module.exports.up = (options) => {
|
||||
|
||||
common.logging.info(`Using backupfile ${path.join(dataPath, mostRecentBackup)}`);
|
||||
|
||||
const backup = require(path.join(dataPath, mostRecentBackup));
|
||||
let backup;
|
||||
try {
|
||||
backup = require(path.join(dataPath, mostRecentBackup));
|
||||
} catch (e) {
|
||||
common.logging.warn(`Could not read ${path.join(dataPath, mostRecentBackup)} whilst trying to ensure boolean settings are correct. Please double check your settings after this upgrade`);
|
||||
return;
|
||||
}
|
||||
const settings = backup && backup.data && backup.data.settings;
|
||||
const migrations = backup && backup.data && backup.data.migrations;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user