gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: logging


From: gnunet
Subject: [taler-wallet-core] branch master updated: logging
Date: Thu, 23 Jul 2020 20:52:51 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 5b8924b8 logging
5b8924b8 is described below

commit 5b8924b8cfe14909b778ec096b3d893a9dde8533
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Fri Jul 24 00:22:46 2020 +0530

    logging
---
 src/headless/helpers.ts          |  2 +-
 src/headless/taler-wallet-cli.ts | 15 ++++++++++++---
 src/operations/pay.ts            |  4 +++-
 src/operations/reserves.ts       | 12 ++++++++----
 src/types/notifications.ts       |  1 +
 5 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index e451db55..3b2f6531 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -79,7 +79,7 @@ export async function getDefaultNodeWallet(
       const dbContent = JSON.parse(dbContentStr);
       myBackend.importDump(dbContent);
     } catch (e) {
-      console.error("could not read wallet file");
+      logger.warn("could not read wallet file");
     }
 
     myBackend.afterCommitCallback = async () => {
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index ca168bf8..2502ec7d 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -30,7 +30,10 @@ import {
   setupRefreshPlanchet,
   encodeCrock,
 } from "../crypto/talerCrypto";
-import { OperationFailedAndReportedError } from "../operations/errors";
+import {
+  OperationFailedAndReportedError,
+  OperationFailedError,
+} from "../operations/errors";
 import { Bank } from "./bank";
 import { classifyTalerUri, TalerUriType } from "../util/taleruri";
 import { Configuration } from "../util/talerconfig";
@@ -167,9 +170,15 @@ async function withWallet<T>(
     const ret = await f(wallet);
     return ret;
   } catch (e) {
-    if (e instanceof OperationFailedAndReportedError) {
+    if (
+      e instanceof OperationFailedAndReportedError ||
+      e instanceof OperationFailedError
+    ) {
       console.error("Operation failed: " + e.message);
-      console.log("Hint: check pending operations for details.");
+      console.error(
+        "Error details:",
+        JSON.stringify(e.operationError, undefined, 2),
+      );
     } else {
       console.error("caught unhandled exception (bug?):", e);
     }
diff --git a/src/operations/pay.ts b/src/operations/pay.ts
index 0027bf0f..58911b4b 100644
--- a/src/operations/pay.ts
+++ b/src/operations/pay.ts
@@ -783,6 +783,8 @@ export async function submitPay(
     coins: purchase.coinDepositPermissions,
     session_id: purchase.lastSessionId,
   };
+  
+  logger.trace("making pay request", JSON.stringify(reqBody, undefined, 2));
 
   const resp = await ws.http.postJson(payUrl, reqBody);
 
@@ -791,7 +793,7 @@ export async function submitPay(
     codecForMerchantPayResponse(),
   );
 
-  console.log("got success from pay URL", merchantResp);
+  logger.trace("got success from pay URL", merchantResp);
 
   const now = getTimestampNow();
 
diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 51499e44..6045b61d 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -240,12 +240,18 @@ export async function createReserve(
     },
   );
 
-  ws.notify({ type: NotificationType.ReserveCreated });
+  if (reserveRecord.reservePub === resp.reservePub) {
+    // Only emit notification when a new reserve was created.
+    ws.notify({
+      type: NotificationType.ReserveCreated,
+      reservePub: reserveRecord.reservePub,
+    });
+  }
 
   // Asynchronously process the reserve, but return
   // to the caller already.
   processReserve(ws, resp.reservePub, true).catch((e) => {
-    console.error("Processing reserve (after createReserve) failed:", e);
+    logger.error("Processing reserve (after createReserve) failed:", e);
   });
 
   return resp;
@@ -318,7 +324,6 @@ async function registerReserveWithBank(
     return;
   }
   const bankStatusUrl = bankInfo.statusUrl;
-  console.log("making selection");
   if (reserve.timestampReserveInfoPosted) {
     throw Error("bank claims that reserve info selection is not done");
   }
@@ -788,7 +793,6 @@ export async function createTalerWithdrawReserve(
   // We do this here, as the reserve should be registered before we return,
   // so that we can redirect the user to the bank's status page.
   await processReserveBankStatus(ws, reserve.reservePub);
-  console.log("acceptWithdrawal: returning");
   return {
     reservePub: reserve.reservePub,
     confirmTransferUrl: withdrawInfo.confirmTransferUrl,
diff --git a/src/types/notifications.ts b/src/types/notifications.ts
index 5d6d2ee1..945b86ee 100644
--- a/src/types/notifications.ts
+++ b/src/types/notifications.ts
@@ -203,6 +203,7 @@ export interface ReserveOperationErrorNotification {
 
 export interface ReserveCreatedNotification {
   type: NotificationType.ReserveCreated;
+  reservePub: string;
 }
 
 export interface PendingOperationProcessedNotification {

-- 
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]