From 335d22b12b3d8ed1a14d39bf8ca17faade9ca34c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 10 Jan 2023 17:11:34 -0300 Subject: when as number instead of string, fix codec used before declaration, pretty --- .../taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts | 3 ++- packages/taler-wallet-core/src/errors.ts | 5 +++-- packages/taler-wallet-core/src/operations/pay-merchant.ts | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts index ca4a79d20..d8d53a839 100644 --- a/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts +++ b/packages/taler-wallet-core/src/crypto/workers/crypto-dispatcher.test.ts @@ -14,6 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ +import { AbsoluteTime } from "@gnu-taler/taler-util"; import test from "ava"; import { CryptoDispatcher, CryptoWorkerFactory } from "./crypto-dispatcher.js"; import { @@ -74,7 +75,7 @@ export class MyCryptoWorker implements CryptoWorker { type: "error", error: { code: 42, - when: "now", + when: AbsoluteTime.now(), hint: "bla", }, }; diff --git a/packages/taler-wallet-core/src/errors.ts b/packages/taler-wallet-core/src/errors.ts index 308e9c7a8..7dbba2e2e 100644 --- a/packages/taler-wallet-core/src/errors.ts +++ b/packages/taler-wallet-core/src/errors.ts @@ -24,6 +24,7 @@ * Imports. */ import { + AbsoluteTime, PayMerchantInsufficientBalanceDetails, PayPeerInsufficientBalanceDetails, TalerErrorCode, @@ -103,7 +104,7 @@ export function makeErrorDetail( if (!hint && !(detail as any).hint) { hint = getDefaultHint(code); } - const when = new Date().toISOString(); + const when = AbsoluteTime.now(); return { code, when, hint, ...detail }; } @@ -161,7 +162,7 @@ export class TalerError extends Error { if (!hint) { hint = getDefaultHint(code); } - const when = new Date().toISOString(); + const when = AbsoluteTime.now(); return new TalerError({ code, when, hint, ...detail }); } diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index 586f2638f..0360f7395 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -1822,7 +1822,7 @@ export async function processPurchase( errorDetail: { // FIXME: allocate more specific error code code: TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION, - when: new Date().toISOString(), + when: AbsoluteTime.now(), hint: `trying to pay for purchase that is not in the database`, proposalId: proposalId, }, @@ -1873,7 +1873,7 @@ export async function processPurchasePay( errorDetail: { // FIXME: allocate more specific error code code: TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION, - when: new Date().toISOString(), + when: AbsoluteTime.now(), hint: `trying to pay for purchase that is not in the database`, proposalId: proposalId, }, @@ -1952,7 +1952,7 @@ export async function processPurchasePay( await scheduleRetry(ws, RetryTags.forPay(purchase), { code: TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION, - when: new Date().toISOString(), + when: AbsoluteTime.now(), message: "unexpected exception", hint: "unexpected exception", details: { -- cgit v1.2.3