wallet-core: improve error message when store is missing

This commit is contained in:
Florian Dold 2023-01-27 12:38:08 +01:00
parent bc4e2d4147
commit af4064ce7e
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -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> => {