taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit af4064ce7e1bedbad478a032b44852e78e2753ef
parent bc4e2d4147eae74aec59d0354fb6b0077d67d691
Author: Florian Dold <florian@dold.me>
Date:   Fri, 27 Jan 2023 12:38:08 +0100

wallet-core: improve error message when store is missing

Diffstat:
Mpackages/taler-wallet-core/src/util/query.ts | 17+++++++++++++++++
1 file 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 @@ -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> => {