gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 01/02: improve error reporting for DB queries


From: gnunet
Subject: [taler-wallet-core] 01/02: improve error reporting for DB queries
Date: Thu, 12 Mar 2020 14:55:46 +0100

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

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

commit 2ec6799c8c6836d44944460a41fabefb8eb8186f
Author: Florian Dold <address@hidden>
AuthorDate: Thu Mar 12 13:22:46 2020 +0530

    improve error reporting for DB queries
---
 src/util/query.ts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/query.ts b/src/util/query.ts
index d08c901a..3303907f 100644
--- a/src/util/query.ts
+++ b/src/util/query.ts
@@ -218,7 +218,7 @@ class ResultStream<T> {
       return { hasValue: false };
     }
     if (!this.awaitingResult) {
-      const cursor = this.req.result;
+      const cursor: IDBCursor | undefined = this.req.result;
       if (!cursor) {
         throw Error("assertion failed");
       }
@@ -330,7 +330,7 @@ function runWithTransaction<T>(
       reject(TransactionAbort);
     };
     const th = new TransactionHandle(tx);
-    const resP = f(th);
+    const resP = Promise.resolve().then(() => f(th));
     resP
       .then(result => {
         gotFunResult = true;
@@ -340,10 +340,12 @@ function runWithTransaction<T>(
         if (e == TransactionAbort) {
           console.info("aborting transaction");
         } else {
-          tx.abort();
           console.error("Transaction failed:", e);
           console.error(stack);
+          tx.abort();
         }
+      }).catch((e) => {
+        console.error("fatal: aborting transaction failed", e);
       });
   });
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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