From b4f4636555e4790c36dd9976e6a297293a6bb668 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 17 Oct 2022 15:56:34 -0500 Subject: [PATCH] Clarify that we no-op because if it's already aborted, that's what we wanted to do anyway (#861) Split off from https://github.com/vector-im/hydrogen-web/pull/653 --- src/matrix/storage/idb/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/matrix/storage/idb/utils.ts b/src/matrix/storage/idb/utils.ts index 4ac373d2..44149e12 100644 --- a/src/matrix/storage/idb/utils.ts +++ b/src/matrix/storage/idb/utils.ts @@ -83,7 +83,11 @@ export function openDatabase(name: string, createObjectStore: CreateObjectStore, // 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);