commit 989bbb8f92d6cc7a9166717115471a7bc27d52e8
parent fe65e2c97b2f4ed95bf4cdf6c4e8c1104ce0846a
Author: Florian Dold <dold@taler.net>
Date: Thu, 6 Aug 2026 14:21:20 +0200
util: allow GENERIC_TIMEOUT to describe non-HTTP timeouts
The detail type was HTTP-shaped, which left wallet-core operations no way
to report a timeout with a proper error code.
Diffstat:
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts
@@ -133,9 +133,14 @@ export interface DetailsMap {
timeoutMs: number;
};
[TalerErrorCode.GENERIC_TIMEOUT]: {
- requestUrl: string;
- requestMethod: string;
- timeoutMs: number;
+ timeoutMs?: number;
+ // Set when an HTTP request timed out.
+ requestUrl?: string;
+ requestMethod?: string;
+ // Set when a wallet-core operation timed out.
+ operation?: string;
+ // Transaction that the timed-out operation was about, if any.
+ transactionId?: string;
};
[TalerErrorCode.WALLET_NETWORK_ERROR]: {
requestUrl: string;
diff --git a/packages/web-util/src/hooks/useNotifications.ts b/packages/web-util/src/hooks/useNotifications.ts
@@ -539,9 +539,12 @@ export function translateTalerError(
) {
return [
i18n.str`The request reached a timeout, check your connection.`,
- i18n.str`The ${cause.errorDetail.requestMethod} request to ${
- cause.errorDetail.requestUrl
- } failed after ${cause.errorDetail.timeoutMs / 1000} seconds.`,
+ // Not every timeout is about an HTTP request.
+ cause.errorDetail.requestUrl
+ ? i18n.str`The ${cause.errorDetail.requestMethod} request to ${
+ cause.errorDetail.requestUrl
+ } failed after ${(cause.errorDetail.timeoutMs ?? 0) / 1000} seconds.`
+ : undefined,
cause.errorDetail.when
? i18n.str`The last request time is ${AbsoluteTime.stringify(
cause.errorDetail.when,