aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-01-27 12:38:08 +0100
committerFlorian Dold <florian@dold.me>2023-01-27 12:38:24 +0100
commitaf4064ce7e1bedbad478a032b44852e78e2753ef (patch)
treed2ce6f48b0f003b6b4c3b774ff68f8c626c469c9 /packages/taler-wallet-core
parentbc4e2d4147eae74aec59d0354fb6b0077d67d691 (diff)
downloadwallet-core-af4064ce7e1bedbad478a032b44852e78e2753ef.tar.xz
wallet-core: improve error message when store is missing
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r--packages/taler-wallet-core/src/util/query.ts17
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> => {