Handle exception when migrating cache

This commit is contained in:
Alexander Zinchuk 2022-12-07 03:25:51 +01:00
parent 8a218504c1
commit 0d3e91a617

View File

@ -140,6 +140,15 @@ function readCache(initialState: GlobalState): GlobalState {
}
export function migrateCache(cached: GlobalState, initialState: GlobalState) {
try {
unsafeMigrateCache(cached, initialState);
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
}
}
function unsafeMigrateCache(cached: GlobalState, initialState: GlobalState) {
// Migrate from legacy setting names
if ('shouldAutoDownloadMediaFromContacts' in cached.settings.byKey) {
const {