[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: -simplify
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: -simplify |
Date: |
Tue, 05 Mar 2024 01:31:47 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 1624c8fd0 -simplify
1624c8fd0 is described below
commit 1624c8fd0b2907b41e570dc8b7889354c07a19c8
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Mar 5 01:31:43 2024 +0100
-simplify
---
packages/taler-wallet-core/src/shepherd.ts | 50 ++++++------------------------
1 file changed, 9 insertions(+), 41 deletions(-)
diff --git a/packages/taler-wallet-core/src/shepherd.ts
b/packages/taler-wallet-core/src/shepherd.ts
index 90cb53aac..a54049d7c 100644
--- a/packages/taler-wallet-core/src/shepherd.ts
+++ b/packages/taler-wallet-core/src/shepherd.ts
@@ -28,7 +28,6 @@ import {
ObservabilityContext,
ObservabilityEventType,
RetryLoopOpts,
- TalerErrorCode,
TalerErrorDetail,
TaskThrottler,
TransactionIdStr,
@@ -38,7 +37,6 @@ import {
assertUnreachable,
getErrorDetailFromException,
j2s,
- makeErrorDetail,
} from "@gnu-taler/taler-util";
import { processBackupForProvider } from "./backup/index.js";
import {
@@ -51,7 +49,6 @@ import {
getExchangeState,
parseTaskIdentifier,
} from "./common.js";
-import { CryptoApiStoppedError } from "./crypto/workers/crypto-dispatcher.js";
import {
OPERATION_STATUS_ACTIVE_FIRST,
OPERATION_STATUS_ACTIVE_LAST,
@@ -343,14 +340,15 @@ export class TaskSchedulerImpl implements TaskScheduler {
);
const startTime = AbsoluteTime.now();
logger.trace(`Shepherd for ${taskId} will call handler`);
- const res = await runTaskWithErrorReporting(
- this.ws,
- taskId,
- info,
- async () => {
- return await callOperationHandlerForTaskId(wex, taskId);
- },
- );
+ let res: TaskRunResult;
+ try {
+ res = await callOperationHandlerForTaskId(wex, taskId);
+ } catch (e) {
+ res = {
+ type: TaskRunResultType.Error,
+ errorDetail: getErrorDetailFromException(e),
+ };
+ }
if (info.cts.token.isCancelled) {
logger.info("task cancelled, not processing result");
return;
@@ -521,36 +519,6 @@ async function storePendingTaskFinished(
});
}
-async function runTaskWithErrorReporting(
- ws: InternalWalletState,
- opId: TaskIdStr,
- info: ShepherdInfo,
- f: () => Promise<TaskRunResult>,
-): Promise<TaskRunResult> {
- try {
- return await f();
- } catch (e) {
- if (e instanceof CryptoApiStoppedError) {
- if (ws.stopped) {
- logger.warn("crypto API stopped during shutdown, ignoring error");
- return {
- type: TaskRunResultType.Error,
- errorDetail: makeErrorDetail(
- TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,
- {},
- "Crypto API stopped during shutdown",
- ),
- };
- }
- }
- const errorDetail = getErrorDetailFromException(e);
- return {
- type: TaskRunResultType.Error,
- errorDetail,
- };
- }
-}
-
function getWalletExecutionContextForTask(
ws: InternalWalletState,
taskId: TaskIdStr,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: -simplify,
gnunet <=