-logging, skip defaults in test
This commit is contained in:
parent
13d6810937
commit
d48ea17c63
@ -1 +1 @@
|
||||
Subproject commit 355a3172699b96f1040edcb577c07a681802b3ae
|
||||
Subproject commit 23538677f6c6be2a62f38dc6137ecdd1c76b7b15
|
@ -121,3 +121,19 @@ export function j2s(x: any): string {
|
||||
export function notEmpty<T>(value: T | null | undefined): value is T {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe function to stringify errors.
|
||||
*/
|
||||
export function stringifyError(x: any): string {
|
||||
if (typeof x === "undefined") {
|
||||
return "<thrown undefined>";
|
||||
}
|
||||
if (x === null) {
|
||||
return `<thrown null>`;
|
||||
}
|
||||
if (typeof x === "object") {
|
||||
return x.toString();
|
||||
}
|
||||
return `<thrown ${typeof x}>`;
|
||||
}
|
@ -118,6 +118,10 @@ export interface Balance {
|
||||
requiresUserInput: boolean;
|
||||
}
|
||||
|
||||
export interface InitRequest {
|
||||
skipDefaults?: boolean;
|
||||
}
|
||||
|
||||
export interface InitResponse {
|
||||
versionInfo: WalletCoreVersion;
|
||||
}
|
||||
|
@ -664,7 +664,8 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
|
||||
const salt = new Uint8Array(saltArrBuf);
|
||||
const saltDataView = new DataView(saltArrBuf);
|
||||
saltDataView.setUint32(0, req.coinNumber);
|
||||
const out = kdf(64, decodeCrock(req.secretSeed), salt, info);
|
||||
const secretSeedDec = decodeCrock(req.secretSeed);
|
||||
const out = kdf(64, secretSeedDec, salt, info);
|
||||
const coinPriv = out.slice(0, 32);
|
||||
const bks = out.slice(32, 64);
|
||||
const coinPrivEnc = encodeCrock(coinPriv);
|
||||
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Imports.
|
||||
*/
|
||||
import { Logger } from "@gnu-taler/taler-util";
|
||||
import { j2s, Logger } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
nativeCryptoR,
|
||||
TalerCryptoInterfaceR,
|
||||
@ -84,6 +84,8 @@ export class SynchronousCryptoWorkerPlain implements CryptoWorker {
|
||||
};
|
||||
handleRequest().catch((e) => {
|
||||
logger.error("Error while handling crypto request:", e);
|
||||
logger.error("Stack:", e.stack);
|
||||
logger.error(`request was ${j2s(msg)}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,12 @@
|
||||
/**
|
||||
* Imports.
|
||||
*/
|
||||
import { j2s, Logger, TalerErrorCode } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
j2s,
|
||||
Logger,
|
||||
stringifyError as safeStringifyError,
|
||||
TalerErrorCode,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { getErrorDetailFromException, makeErrorDetail } from "../../errors.js";
|
||||
import { TalerCryptoInterfaceR } from "../cryptoImplementation.js";
|
||||
import {
|
||||
@ -88,7 +93,7 @@ export async function processRequestWithImpl(
|
||||
const result = await (impl as any)[operation](impl, reqMsg.req);
|
||||
responseMsg = { type: "success", result, id };
|
||||
} catch (e: any) {
|
||||
logger.error(`error during operation: ${e.stack ?? e.toString()}`);
|
||||
logger.error(`error during operation: ${safeStringifyError(e)}`);
|
||||
responseMsg = {
|
||||
type: "error",
|
||||
error: getErrorDetailFromException(e),
|
||||
|
@ -106,6 +106,7 @@ import {
|
||||
WithdrawTestBalanceRequest,
|
||||
WithdrawUriInfoResponse,
|
||||
UserAttentionByIdRequest,
|
||||
InitRequest,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { WalletContractData } from "./db.js";
|
||||
import {
|
||||
@ -200,7 +201,7 @@ type EmptyObject = Record<string, never>;
|
||||
*/
|
||||
export type InitWalletOp = {
|
||||
op: WalletApiOperation.InitWallet;
|
||||
request: EmptyObject;
|
||||
request: InitRequest;
|
||||
response: InitResponse;
|
||||
};
|
||||
|
||||
|
@ -424,7 +424,9 @@ export async function testWithGv() {
|
||||
|
||||
export async function testWithLocal() {
|
||||
const w = await getWallet();
|
||||
await w.wallet.client.call(WalletApiOperation.InitWallet, {});
|
||||
await w.wallet.client.call(WalletApiOperation.InitWallet, {
|
||||
skipDefaults: true,
|
||||
});
|
||||
await w.wallet.client.call(WalletApiOperation.RunIntegrationTest, {
|
||||
amountToSpend: "TESTKUDOS:1",
|
||||
amountToWithdraw: "TESTKUDOS:3",
|
||||
|
Loading…
Reference in New Issue
Block a user