diff options
| author | Sebastian <sebasjm@gmail.com> | 2023-01-10 17:11:34 -0300 | 
|---|---|---|
| committer | Sebastian <sebasjm@gmail.com> | 2023-01-11 15:30:14 -0300 | 
| commit | 335d22b12b3d8ed1a14d39bf8ca17faade9ca34c (patch) | |
| tree | b70fa6cb38fdd0951287da17b51671497cce7678 /packages/taler-wallet-core | |
| parent | 52be8c915885351cf79f065a7c1787ce8ee7ec89 (diff) | |
when as number instead of string, fix codec used before declaration, pretty
Diffstat (limited to 'packages/taler-wallet-core')
3 files changed, 8 insertions, 6 deletions
| 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 <http://www.gnu.org/licenses/>   */ +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<C extends TalerErrorCode>(    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<T = any> extends Error {      if (!hint) {        hint = getDefaultHint(code);      } -    const when = new Date().toISOString(); +    const when = AbsoluteTime.now();      return new TalerError<unknown>({ 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: { | 
