Don't reset settings on failed extconfpatches application

This commit is contained in:
Tamius Han 2025-01-30 01:28:44 +01:00
parent a92f5fc2a1
commit f994617d44

View File

@ -186,7 +186,6 @@ class Settings {
}
// apply all remaining patches
try {
this.logger?.log('info', 'settings', `[Settings::applySettingsPatches] There are ${patches.length - index} settings patches to apply`);
while (index < patches.length) {
const updateFn = patches[index].updateFn;
@ -199,19 +198,13 @@ class Settings {
if (updateFn) {
try {
updateFn(this.active, this.getDefaultSettings());
} catch (e) {
this.logger?.log('error', 'settings', '[Settings::applySettingsPatches] Failed to execute update function. Keeping settings object as-is. Error:', e);
}
updateFn(this.active, this.getDefaultSettings());
} catch (e) {
this.logger?.log('error', 'settings', '[Settings::applySettingsPatches] Failed to execute update function. Keeping settings object as-is. Error:', e);
}
index++;
}
} catch (e) {
console.error('Failed to upgrade settings.', e);
this.setActive(this.getDefaultSettings());
this.save();
index++;
}
}