From b54e884b7e9a5912020ae0ef5c08b76a47901ca7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 21 Jul 2022 17:39:42 -0500 Subject: [PATCH] Expose error when we fail to createObjectStore --- src/matrix/storage/idb/utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/matrix/storage/idb/utils.ts b/src/matrix/storage/idb/utils.ts index 4ac373d2..b685f365 100644 --- a/src/matrix/storage/idb/utils.ts +++ b/src/matrix/storage/idb/utils.ts @@ -80,10 +80,15 @@ export function openDatabase(name: string, createObjectStore: CreateObjectStore, try { await createObjectStore(db, txn, oldVersion, version); } catch (err) { + console.error(`Failed to createObjectStore in database=${name}`, err); // try aborting on error, if that hasn't been done already try { txn.abort(); - } catch (err) {} + } catch (err) { + // No-op: `InvalidStateError` is only thrown if the transaction has + // already been committed or aborted. Since we wanted the txn to + // be aborted anyway, it doesn't matter if this fails. + } } }; return reqAsPromise(req);