diff --git a/applications/webapp/src/index.tsx b/applications/webapp/src/index.tsx
index 98dba6c..b579481 100644
--- a/applications/webapp/src/index.tsx
+++ b/applications/webapp/src/index.tsx
@@ -18,6 +18,7 @@ import reportWebVitals from "./reportWebVitals";
import { client } from "./graphql/client";
import { ApolloProvider } from "@apollo/client";
import { initKeycloak, refreshToken } from "./Authentication/Keycloak";
+import KeycloakError from "./keycloakError";
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement,
@@ -33,6 +34,14 @@ const renderRoot = () => {
);
};
+const renderKeycloakErrorPage = () => {
+ return root.render(
+
+
+ ,
+ );
+};
+
initKeycloak()
.then(() => {
renderRoot();
@@ -40,11 +49,8 @@ initKeycloak()
const intervalTime = 300000;
setInterval(refreshToken, intervalTime);
})
- .catch((error) => {
- throw new Error(
- `[index.initKeycloak()] An error occurred during keycloak initialization:`,
- error,
- );
+ .catch(() => {
+ renderKeycloakErrorPage();
});
reportWebVitals();
diff --git a/applications/webapp/src/keycloakError.test.tsx b/applications/webapp/src/keycloakError.test.tsx
new file mode 100644
index 0000000..88edf59
--- /dev/null
+++ b/applications/webapp/src/keycloakError.test.tsx
@@ -0,0 +1,21 @@
+/**
+ * Humanitech Supply Trail
+ *
+ * Copyright (c) Humanitech, Peter Rogov and Contributors
+ *
+ * Website: https://humanitech.net
+ * Repository: https://github.com/humanitech-net/supply-trail
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from "react";
+import { render } from "@testing-library/react";
+import KeycloakError from "./keycloakError";
+
+describe("Keycloak Error Page", () => {
+ test("renders Keycloak Error Component", () => {
+ render();
+ });
+});
diff --git a/applications/webapp/src/keycloakError.tsx b/applications/webapp/src/keycloakError.tsx
new file mode 100644
index 0000000..da649b4
--- /dev/null
+++ b/applications/webapp/src/keycloakError.tsx
@@ -0,0 +1,35 @@
+/**
+ * Humanitech Supply Trail
+ *
+ * Copyright (c) Humanitech, Peter Rogov and Contributors
+ *
+ * Website: https://humanitech.net
+ * Repository: https://github.com/humanitech-net/supply-trail
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from "react";
+import { Container, Typography } from "@mui/material";
+
+export default function KeycloakError() {
+ const style = {
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "center",
+ alignItems: "center",
+ height: "100vh",
+ };
+
+ return (
+
+
+ Internal Server Error
+
+
+ An error occurred during keycloak initialization
+
+
+ );
+}