This commit is contained in:
Florian Dold 2020-07-24 00:22:46 +05:30
parent 56ece296e0
commit 5b8924b8cf
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 25 additions and 9 deletions

View File

@ -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 () => {

View File

@ -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);
}

View File

@ -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();

View File

@ -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,

View File

@ -203,6 +203,7 @@ export interface ReserveOperationErrorNotification {
export interface ReserveCreatedNotification {
type: NotificationType.ReserveCreated;
reservePub: string;
}
export interface PendingOperationProcessedNotification {