Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error messages/handling for 2.18 migrations #10608

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,6 +22,11 @@ module.exports.up = (options) => {
}, options);

return fs.readdir(dataPath).then(function (files) {
return files;
}).catch(function () {
kirrg001 marked this conversation as resolved.
Show resolved Hide resolved
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) {
Expand All @@ -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;

Expand Down