aboutsummaryrefslogtreecommitdiff
path: root/packages/idb-bridge
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2020-12-14 16:45:10 +0100
committerFlorian Dold <florian@dold.me>2020-12-14 16:45:10 +0100
commitc4b44a51097e67a357b490adf407f1a6afb0d8ee (patch)
treeffb8cab47bd2654a50d87aaae9b1819a27dfc3c7 /packages/idb-bridge
parent12234083ecfe83de79eb2caf29808a0f17188e84 (diff)
slightly more helpful error message
Diffstat (limited to 'packages/idb-bridge')
-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 = {