Use default settings on loading failure

jh-changes
Shin'ya Ueoka 5 years ago
parent 04c077d614
commit 67e02cd9cb
  1. 7
      src/settings/storage.ts

@ -5,7 +5,12 @@ export const load = async(): Promise<SettingData> => {
if (!settings) { if (!settings) {
return DefaultSettingData; 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) => { export const save = (data: SettingData) => {