aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/refresh.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/refresh.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts31
1 files changed, 30 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 2d406ec7d..477a00503 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -36,14 +36,18 @@ import {
ExchangeProtocolVersion,
ExchangeRefreshRevealRequest,
fnutil,
+ getErrorDetailFromException,
getRandomBytes,
HashCodeString,
HttpStatusCode,
j2s,
Logger,
+ makeErrorDetail,
NotificationType,
RefreshGroupId,
RefreshReason,
+ TalerErrorCode,
+ TalerErrorDetail,
TalerProtocolTimestamp,
URL,
} from "@gnu-taler/taler-util";
@@ -755,13 +759,18 @@ export async function processRefreshGroup(
}
// Process refresh sessions of the group in parallel.
logger.trace("processing refresh sessions for old coins");
+ let errors: TalerErrorDetail[] = [];
+ let inShutdown = false;
const ps = refreshGroup.oldCoinPubs.map((x, i) =>
processRefreshSession(ws, refreshGroupId, i).catch((x) => {
if (x instanceof CryptoApiStoppedError) {
+ inShutdown = true;
logger.info(
"crypto API stopped while processing refresh group, probably the wallet is currently shutting down.",
);
- } else if (x instanceof TalerError) {
+ return;
+ }
+ if (x instanceof TalerError) {
logger.warn("process refresh session got exception (TalerError)");
logger.warn(`exc ${x}`);
logger.warn(`exc stack ${x.stack}`);
@@ -771,6 +780,7 @@ export async function processRefreshGroup(
logger.warn(`exc ${x}`);
logger.warn(`exc stack ${x.stack}`);
}
+ errors.push(getErrorDetailFromException(x));
}),
);
try {
@@ -781,6 +791,25 @@ export async function processRefreshGroup(
logger.warn("process refresh sessions got exception");
logger.warn(`exception: ${e}`);
}
+ if (inShutdown) {
+ return {
+ type: OperationAttemptResultType.Pending,
+ result: undefined,
+ };
+ }
+ if (errors.length > 0) {
+ return {
+ type: OperationAttemptResultType.Error,
+ errorDetail: makeErrorDetail(
+ TalerErrorCode.WALLET_REFRESH_GROUP_INCOMPLETE,
+ {
+ numErrors: errors.length,
+ errors: errors.slice(0, 5),
+ },
+ ),
+ };
+ }
+
return {
type: OperationAttemptResultType.Finished,
result: undefined,