summaryrefslogtreecommitdiff
path: root/packages/idb-bridge
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-06-10 10:37:49 +0200
committerFlorian Dold <florian@dold.me>2021-06-10 10:37:49 +0200
commit7b7e3b4565169835ad04062d5c76ba655abd770a (patch)
treea6fe6ade0852d85e91410d57f52c18cb6c547197 /packages/idb-bridge
parent67e5d68b9309c6d35a92bb052879c41854b2ea73 (diff)
downloadwallet-core-7b7e3b4565169835ad04062d5c76ba655abd770a.tar.gz
wallet-core-7b7e3b4565169835ad04062d5c76ba655abd770a.tar.bz2
wallet-core-7b7e3b4565169835ad04062d5c76ba655abd770a.zip
transaction fixes
Diffstat (limited to 'packages/idb-bridge')
-rw-r--r--packages/idb-bridge/src/bridge-idb.ts19
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");
}
}