commit a6747a8af80bd9d2a44fc1eeea1cefbda9646536
parent 95261ec6c955b1bdc3aa8e76c04b004e8a2b06e6
Author: Florian Dold <florian@dold.me>
Date: Wed, 30 Oct 2024 20:19:35 +0100
wallet-core: improve logging, cancellation handling
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
@@ -435,6 +435,8 @@ walletCli
if (resp.type === "error") {
if (args.api.expectSuccess) {
processExit(EXIT_API_ERROR);
+ } else {
+ logger.warn("api request resulted in error response");
}
}
} catch (e) {
diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts
@@ -396,6 +396,14 @@ export class TaskSchedulerImpl implements TaskScheduler {
try {
res = await callOperationHandlerForTaskId(wex, taskId);
} catch (e) {
+ if (info.cts.token.isCancelled) {
+ logger.trace(`task ${taskId} cancelled, ignoring task error`);
+ return;
+ }
+ if (this.ws.stopped) {
+ logger.trace("wallet stopped, ignoring task error");
+ return;
+ }
const errorDetail = getErrorDetailFromException(e);
logger.trace(
`Shepherd error ${taskId} saving response ${j2s(errorDetail)}`,