From 358ee4ab72b11ac7fd7a54ea11d3ea038c3eb456 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 7 Oct 2020 17:46:52 -0700 Subject: [PATCH] storage: Don't throw if we store undefined --- js/storage.js | 2 +- ts/background.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/storage.js b/js/storage.js index 57acd339d..fd0654845 100644 --- a/js/storage.js +++ b/js/storage.js @@ -13,7 +13,7 @@ async function put(key, value) { if (value === undefined) { - throw new Error('Tried to store undefined'); + window.log.warn(`storage/put: undefined provided for key ${key}`); } if (!ready) { window.log.warn('Called storage.put before storage is ready. key:', key); diff --git a/ts/background.ts b/ts/background.ts index 16bdb31a9..bc9cc3acf 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -2896,19 +2896,19 @@ type WhatIsThis = typeof window.WhatIsThis; // These two bits of data are important to ensure that the app loads up // the conversation list, instead of showing just the QR code screen. window.Signal.Util.Registration.markEverDone(); - window.textsecure.storage.put(NUMBER_ID_KEY, previousNumberId); + await window.textsecure.storage.put(NUMBER_ID_KEY, previousNumberId); // These two are important to ensure we don't rip through every message // in the database attempting to upgrade it after starting up again. - window.textsecure.storage.put( + await window.textsecure.storage.put( IS_MIGRATION_COMPLETE_KEY, isMigrationComplete || false ); - window.textsecure.storage.put( + await window.textsecure.storage.put( LAST_PROCESSED_INDEX_KEY, lastProcessedIndex || null ); - window.textsecure.storage.put(VERSION_KEY, window.getVersion()); + await window.textsecure.storage.put(VERSION_KEY, window.getVersion()); window.log.info('Successfully cleared local configuration'); } catch (eraseError) {