From af4064ce7e1bedbad478a032b44852e78e2753ef Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 27 Jan 2023 12:38:08 +0100 Subject: wallet-core: improve error message when store is missing --- packages/taler-wallet-core/src/util/query.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'packages/taler-wallet-core') 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 { 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 = ( txf: ReadOnlyTransactionFunction, ): Promise => { -- cgit v1.2.3