aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/db.ts32
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts1
2 files changed, 24 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index d929fd123..9ca88d086 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -21,6 +21,7 @@ import {
Event,
IDBDatabase,
IDBFactory,
+ IDBObjectStore,
IDBTransaction,
} from "@gnu-taler/idb-bridge";
import {
@@ -2477,20 +2478,35 @@ function upgradeFromStoreMap(
if (storeAddedVersion <= oldVersion) {
continue;
}
- const s = db.createObjectStore(swi.storeName, {
- autoIncrement: storeDesc.autoIncrement,
- keyPath: storeDesc.keyPath,
- });
+ let s: IDBObjectStore;
+ try {
+ s = db.createObjectStore(swi.storeName, {
+ autoIncrement: storeDesc.autoIncrement,
+ keyPath: storeDesc.keyPath,
+ });
+ } catch (e) {
+ const moreInfo = e instanceof Error ? ` Reason: ${e.message}` : "";
+ throw Error(
+ `Migration failed. Could not create store ${swi.storeName}.${moreInfo}`,
+ );
+ }
for (const indexName in swi.indexMap as any) {
const indexDesc: IndexDescriptor = swi.indexMap[indexName];
const indexAddedVersion = indexDesc.versionAdded ?? 0;
if (indexAddedVersion <= oldVersion) {
continue;
}
- s.createIndex(indexDesc.name, indexDesc.keyPath, {
- multiEntry: indexDesc.multiEntry,
- unique: indexDesc.unique,
- });
+ try {
+ s.createIndex(indexDesc.name, indexDesc.keyPath, {
+ multiEntry: indexDesc.multiEntry,
+ unique: indexDesc.unique,
+ });
+ } catch (e) {
+ const moreInfo = e instanceof Error ? ` Reason: ${e.message}` : "";
+ throw Error(
+ `Migration failed. Could not create index ${indexDesc.name}/${indexDesc.keyPath}.${moreInfo}`,
+ );
+ }
}
}
}
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 2570a4e5f..43ee97239 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -734,7 +734,6 @@ async function buildTransactionForPurchase(
checkDbInvariant(!!timestamp);
checkDbInvariant(!!purchaseRecord.payInfo);
-
let status: ExtendedStatus;
switch (purchaseRecord.purchaseStatus) {
case PurchaseStatus.AbortingWithRefund: