diff options
author | Florian Dold <florian@dold.me> | 2021-06-10 10:37:49 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-10 10:37:49 +0200 |
commit | 7b7e3b4565169835ad04062d5c76ba655abd770a (patch) | |
tree | a6fe6ade0852d85e91410d57f52c18cb6c547197 /packages/idb-bridge | |
parent | 67e5d68b9309c6d35a92bb052879c41854b2ea73 (diff) | |
download | wallet-core-7b7e3b4565169835ad04062d5c76ba655abd770a.tar.xz |
transaction fixes
Diffstat (limited to 'packages/idb-bridge')
-rw-r--r-- | packages/idb-bridge/src/bridge-idb.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/idb-bridge/src/bridge-idb.ts b/packages/idb-bridge/src/bridge-idb.ts index 58cec8673..ecabfbc7a 100644 --- a/packages/idb-bridge/src/bridge-idb.ts +++ b/packages/idb-bridge/src/bridge-idb.ts @@ -1201,19 +1201,26 @@ export class BridgeIDBIndex implements IDBIndex { private _confirmIndexExists() { const storeSchema = this._schema.objectStores[this._objectStore._name]; if (!storeSchema) { - throw new InvalidStateError(); + throw new InvalidStateError( + `no schema for object store '${this._objectStore._name}'`, + ); } if (!storeSchema.indexes[this._name]) { - throw new InvalidStateError(); + throw new InvalidStateError( + `no schema for index '${this._name}' of object store '${this._objectStore._name}'`, + ); } } get(key: BridgeIDBKeyRange | IDBValidKey) { - this._confirmIndexExists(); - this._confirmActiveTransaction(); if (this._deleted) { throw new InvalidStateError(); } + if (this._objectStore._deleted) { + throw new InvalidStateError(); + } + this._confirmActiveTransaction(); + this._confirmIndexExists(); if (!(key instanceof BridgeIDBKeyRange)) { key = BridgeIDBKeyRange._valueToKeyRange(key); @@ -1595,10 +1602,10 @@ export class BridgeIDBObjectStore implements IDBObjectStore { */ _confirmActiveTransaction(): void { if (!this._transaction._active) { - throw new TransactionInactiveError(); + throw new TransactionInactiveError("transaction is not active"); } if (this._transaction._aborted) { - throw new TransactionInactiveError(); + throw new TransactionInactiveError("transaction has been aborted"); } } |