aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/idb-bridge/src/BridgeIDBObjectStore.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/idb-bridge/src/BridgeIDBObjectStore.ts b/packages/idb-bridge/src/BridgeIDBObjectStore.ts
index 06bd0f590..6fdf35200 100644
--- a/packages/idb-bridge/src/BridgeIDBObjectStore.ts
+++ b/packages/idb-bridge/src/BridgeIDBObjectStore.ts
@@ -206,7 +206,13 @@ export class BridgeIDBObjectStore {
if (key instanceof BridgeIDBKeyRange) {
keyRange = key;
} else {
- keyRange = BridgeIDBKeyRange.only(valueToKey(key));
+ try {
+ keyRange = BridgeIDBKeyRange.only(valueToKey(key));
+ } catch (e) {
+ throw Error(
+ `invalid key (type ${typeof key}) for object store ${this._name}`,
+ );
+ }
}
const recordRequest: RecordGetRequest = {