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 // apply all remaining patches
try {
this.logger?.log('info', 'settings', `[Settings::applySettingsPatches] There are ${patches.length - index} settings patches to apply`); this.logger?.log('info', 'settings', `[Settings::applySettingsPatches] There are ${patches.length - index} settings patches to apply`);
while (index < patches.length) { while (index < patches.length) {
const updateFn = patches[index].updateFn; const updateFn = patches[index].updateFn;
@ -202,17 +201,11 @@ class Settings {
updateFn(this.active, this.getDefaultSettings()); updateFn(this.active, this.getDefaultSettings());
} catch (e) { } catch (e) {
this.logger?.log('error', 'settings', '[Settings::applySettingsPatches] Failed to execute update function. Keeping settings object as-is. Error:', e); this.logger?.log('error', 'settings', '[Settings::applySettingsPatches] Failed to execute update function. Keeping settings object as-is. Error:', e);
} }
} }
index++; index++;
} }
} catch (e) {
console.error('Failed to upgrade settings.', e);
this.setActive(this.getDefaultSettings());
this.save();
}
} }
async init() { async init() {