logging
This commit is contained in:
parent
56ece296e0
commit
5b8924b8cf
@ -79,7 +79,7 @@ export async function getDefaultNodeWallet(
|
|||||||
const dbContent = JSON.parse(dbContentStr);
|
const dbContent = JSON.parse(dbContentStr);
|
||||||
myBackend.importDump(dbContent);
|
myBackend.importDump(dbContent);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("could not read wallet file");
|
logger.warn("could not read wallet file");
|
||||||
}
|
}
|
||||||
|
|
||||||
myBackend.afterCommitCallback = async () => {
|
myBackend.afterCommitCallback = async () => {
|
||||||
|
@ -30,7 +30,10 @@ import {
|
|||||||
setupRefreshPlanchet,
|
setupRefreshPlanchet,
|
||||||
encodeCrock,
|
encodeCrock,
|
||||||
} from "../crypto/talerCrypto";
|
} from "../crypto/talerCrypto";
|
||||||
import { OperationFailedAndReportedError } from "../operations/errors";
|
import {
|
||||||
|
OperationFailedAndReportedError,
|
||||||
|
OperationFailedError,
|
||||||
|
} from "../operations/errors";
|
||||||
import { Bank } from "./bank";
|
import { Bank } from "./bank";
|
||||||
import { classifyTalerUri, TalerUriType } from "../util/taleruri";
|
import { classifyTalerUri, TalerUriType } from "../util/taleruri";
|
||||||
import { Configuration } from "../util/talerconfig";
|
import { Configuration } from "../util/talerconfig";
|
||||||
@ -167,9 +170,15 @@ async function withWallet<T>(
|
|||||||
const ret = await f(wallet);
|
const ret = await f(wallet);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof OperationFailedAndReportedError) {
|
if (
|
||||||
|
e instanceof OperationFailedAndReportedError ||
|
||||||
|
e instanceof OperationFailedError
|
||||||
|
) {
|
||||||
console.error("Operation failed: " + e.message);
|
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 {
|
} else {
|
||||||
console.error("caught unhandled exception (bug?):", e);
|
console.error("caught unhandled exception (bug?):", e);
|
||||||
}
|
}
|
||||||
|
@ -783,6 +783,8 @@ export async function submitPay(
|
|||||||
coins: purchase.coinDepositPermissions,
|
coins: purchase.coinDepositPermissions,
|
||||||
session_id: purchase.lastSessionId,
|
session_id: purchase.lastSessionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
logger.trace("making pay request", JSON.stringify(reqBody, undefined, 2));
|
||||||
|
|
||||||
const resp = await ws.http.postJson(payUrl, reqBody);
|
const resp = await ws.http.postJson(payUrl, reqBody);
|
||||||
|
|
||||||
@ -791,7 +793,7 @@ export async function submitPay(
|
|||||||
codecForMerchantPayResponse(),
|
codecForMerchantPayResponse(),
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("got success from pay URL", merchantResp);
|
logger.trace("got success from pay URL", merchantResp);
|
||||||
|
|
||||||
const now = getTimestampNow();
|
const now = getTimestampNow();
|
||||||
|
|
||||||
|
@ -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
|
// Asynchronously process the reserve, but return
|
||||||
// to the caller already.
|
// to the caller already.
|
||||||
processReserve(ws, resp.reservePub, true).catch((e) => {
|
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;
|
return resp;
|
||||||
@ -318,7 +324,6 @@ async function registerReserveWithBank(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const bankStatusUrl = bankInfo.statusUrl;
|
const bankStatusUrl = bankInfo.statusUrl;
|
||||||
console.log("making selection");
|
|
||||||
if (reserve.timestampReserveInfoPosted) {
|
if (reserve.timestampReserveInfoPosted) {
|
||||||
throw Error("bank claims that reserve info selection is not done");
|
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,
|
// 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.
|
// so that we can redirect the user to the bank's status page.
|
||||||
await processReserveBankStatus(ws, reserve.reservePub);
|
await processReserveBankStatus(ws, reserve.reservePub);
|
||||||
console.log("acceptWithdrawal: returning");
|
|
||||||
return {
|
return {
|
||||||
reservePub: reserve.reservePub,
|
reservePub: reserve.reservePub,
|
||||||
confirmTransferUrl: withdrawInfo.confirmTransferUrl,
|
confirmTransferUrl: withdrawInfo.confirmTransferUrl,
|
||||||
|
@ -203,6 +203,7 @@ export interface ReserveOperationErrorNotification {
|
|||||||
|
|
||||||
export interface ReserveCreatedNotification {
|
export interface ReserveCreatedNotification {
|
||||||
type: NotificationType.ReserveCreated;
|
type: NotificationType.ReserveCreated;
|
||||||
|
reservePub: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PendingOperationProcessedNotification {
|
export interface PendingOperationProcessedNotification {
|
||||||
|
Loading…
Reference in New Issue
Block a user