aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui')
-rw-r--r--packages/merchant-backoffice-ui/src/InstanceRoutes.tsx50
1 files changed, 33 insertions, 17 deletions
diff --git a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
index 5929b031a..e31ff4513 100644
--- a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
+++ b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
@@ -22,6 +22,7 @@
import {
useTranslationContext,
HttpError,
+ ErrorType,
} from "@gnu-taler/web-util/lib/index.browser";
import { format } from "date-fns";
import { Fragment, FunctionComponent, h, VNode } from "preact";
@@ -163,16 +164,25 @@ export function InstanceRoutes({
return function ServerErrorRedirectToImpl(
error: HttpError<MerchantBackend.ErrorDetail>,
) {
- setGlobalNotification({
- message: i18n.str`The backend reported a problem: HTTP status #${error.status}`,
- description: i18n.str`Diagnostic from ${error.info?.url} is "${error.message}"`,
- details:
- error.clientError || error.serverError
- ? error.error?.detail
- : undefined,
- type: "ERROR",
- to,
- });
+ if (error.type === ErrorType.TIMEOUT) {
+ setGlobalNotification({
+ message: i18n.str`The request to the backend take too long and was cancelled`,
+ description: i18n.str`Diagnostic from ${error.info?.url} is "${error.message}"`,
+ type: "ERROR",
+ to,
+ });
+ } else {
+ setGlobalNotification({
+ message: i18n.str`The backend reported a problem: HTTP status #${error.status}`,
+ description: i18n.str`Diagnostic from ${error.info?.url} is "${error.message}"`,
+ details:
+ error.clientError || error.serverError
+ ? error.error?.detail
+ : undefined,
+ type: "ERROR",
+ to,
+ });
+ }
return <Redirect to={to} />;
};
}
@@ -572,19 +582,25 @@ function AdminInstanceUpdatePage({
{...rest}
instanceId={id}
onLoadError={(error: HttpError<MerchantBackend.ErrorDetail>) => {
- return (
- <Fragment>
- <NotificationCard
- notification={{
+ const notif =
+ error.type === ErrorType.TIMEOUT
+ ? {
+ message: i18n.str`The request to the backend take too long and was cancelled`,
+ description: i18n.str`Diagnostic from ${error.info?.url} is "${error.message}"`,
+ type: "ERROR" as const,
+ }
+ : {
message: i18n.str`The backend reported a problem: HTTP status #${error.status}`,
description: i18n.str`Diagnostic from ${error.info?.url} is "${error.message}"`,
details:
error.clientError || error.serverError
? error.error?.detail
: undefined,
- type: "ERROR",
- }}
- />
+ type: "ERROR" as const,
+ };
+ return (
+ <Fragment>
+ <NotificationCard notification={notif} />
<LoginPage onConfirm={updateLoginStatus} />
</Fragment>
);