gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: more information if migration


From: gnunet
Subject: [taler-wallet-core] branch master updated: more information if migration failed, and pretty
Date: Thu, 12 Jan 2023 19:52:07 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 72ca5ee8d more information if migration failed, and pretty
72ca5ee8d is described below

commit 72ca5ee8dda247c1567b5f8d3878cd8371a9983f
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Thu Jan 12 15:50:36 2023 -0300

    more information if migration failed, and pretty
---
 packages/taler-wallet-core/src/db.ts               | 32 ++++++++++++++++------
 .../src/operations/transactions.ts                 |  1 -
 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:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]