From f994617d443f84b7ff344f4c0ffeeb9d463556cd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 30 Jan 2025 01:28:44 +0100 Subject: [PATCH] Don't reset settings on failed extconfpatches application --- src/ext/lib/Settings.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/ext/lib/Settings.ts b/src/ext/lib/Settings.ts index cf86857..6dad085 100644 --- a/src/ext/lib/Settings.ts +++ b/src/ext/lib/Settings.ts @@ -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++; } }