Handle convert error

pull/1/head
Made Baruna 2021-05-19 13:05:12 +08:00
parent d21df64719
commit 6c554022ad
No known key found for this signature in database
GPG Key ID: 5AA5DA16AA5DCEAD
2 changed files with 15 additions and 3 deletions

View File

@ -122,7 +122,11 @@
const converted = convertTime(JSON.parse(remoteSave[key]));
await updateSave(key, converted, true);
} else {
await updateSave(key, JSON.parse(remoteSave[key]), true);
try {
await updateSave(key, JSON.parse(remoteSave[key]), true);
} catch (err) {
await updateSave(key, remoteSave[key], true);
}
}
}
console.log('finished convert from google drive');
@ -151,7 +155,11 @@
const converted = convertTime(JSON.parse(remoteSave[key]));
await updateSave(key, converted, true);
} else {
await updateSave(key, JSON.parse(remoteSave[key]), true);
try {
await updateSave(key, JSON.parse(remoteSave[key]), true);
} catch (err) {
await updateSave(key, remoteSave[key], true);
}
}
} else {
await updateSave(key, remoteSave[key], true);

View File

@ -93,7 +93,11 @@ const convertSave = async () => {
const converted = convertTime(JSON.parse(value));
await localforage.setItem(key, converted);
} else {
await localforage.setItem(key, JSON.parse(value));
try {
await localforage.setItem(key, JSON.parse(value));
} catch (err) {
await localforage.setItem(key, value);
}
}
if (!key.endsWith('locale')) {