diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-08-28 22:06:48 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-08-28 22:18:23 +0900 |
commit | 67e02cd9cb772a6b37e0d0fff3131d8ef4657d45 (patch) | |
tree | 6c6a349b585f0c29dce2dc0fa436df21d10e7278 /src/settings | |
parent | 04c077d614b3eae95da1e9b506171a87948a4179 (diff) |
Use default settings on loading failure
Diffstat (limited to 'src/settings')
-rw-r--r-- | src/settings/storage.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/settings/storage.ts b/src/settings/storage.ts index c0005b7..32b6351 100644 --- a/src/settings/storage.ts +++ b/src/settings/storage.ts @@ -5,7 +5,12 @@ export const load = async(): Promise<SettingData> => { if (!settings) { return DefaultSettingData; } - return SettingData.valueOf(settings as any); + try { + return SettingData.valueOf(settings as any); + } catch (e) { + console.error('unable to load settings', e); + return DefaultSettingData; + } }; export const save = (data: SettingData) => { |