diff options
author | Florian Dold <florian@dold.me> | 2023-01-27 12:38:08 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-01-27 12:38:24 +0100 |
commit | af4064ce7e1bedbad478a032b44852e78e2753ef (patch) | |
tree | d2ce6f48b0f003b6b4c3b774ff68f8c626c469c9 /packages/taler-wallet-core/src | |
parent | bc4e2d4147eae74aec59d0354fb6b0077d67d691 (diff) | |
download | wallet-core-af4064ce7e1bedbad478a032b44852e78e2753ef.tar.xz |
wallet-core: improve error message when store is missing
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/util/query.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts index 56a23c2dd..0efda88cf 100644 --- a/packages/taler-wallet-core/src/util/query.ts +++ b/packages/taler-wallet-core/src/util/query.ts @@ -670,6 +670,23 @@ export class DbAccess<StoreMap> { accessibleStores[sn] = swi; } + const storeMapKeys = Object.keys(this.stores as any); + for (const storeMapKey of storeMapKeys) { + const swi = (this.stores as any)[storeMapKey] as StoreWithIndexes< + any, + any, + any + >; + if (!accessibleStores[swi.storeName]) { + const version = this.db.version; + throw Error( + `store '${swi.storeName}' required by schema but not in database (minver=${version})`, + ); + } + } + + logger.info(`accessible stores: ${Object.keys(accessibleStores)}`); + const runReadOnly = <T>( txf: ReadOnlyTransactionFunction<StoreMap, T>, ): Promise<T> => { |