diff options
author | Florian Dold <florian@dold.me> | 2020-12-14 16:45:10 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-14 16:45:10 +0100 |
commit | c4b44a51097e67a357b490adf407f1a6afb0d8ee (patch) | |
tree | ffb8cab47bd2654a50d87aaae9b1819a27dfc3c7 | |
parent | 12234083ecfe83de79eb2caf29808a0f17188e84 (diff) |
slightly more helpful error message
-rw-r--r-- | packages/idb-bridge/src/BridgeIDBObjectStore.ts | 8 |
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 = { |