diff --git a/frontend/src/layouts/AppLayout/ErrorBoundary.tsx b/frontend/src/layouts/AppLayout/ErrorBoundary.tsx new file mode 100644 index 000000000..cce9885ab --- /dev/null +++ b/frontend/src/layouts/AppLayout/ErrorBoundary.tsx @@ -0,0 +1,86 @@ +import React, { ErrorInfo, ReactNode } from "react"; +import { useRouter } from "next/router"; +import { faBugs } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +interface ErrorBoundaryProps { + children: ReactNode; +} + +interface ErrorBoundaryState { + hasError: boolean; + error: Error | null; +} + +const ErrorPage = ({ error }: { error: Error | null }) => { + const router = useRouter(); + const currentUrl = router?.asPath?.split("?")?.[0]; + + return ( +
+ Something unexpected went wrong. Please contact{" "} + + support@infisical.com + {" "} + if the issue persists. +
+ + {error && ( +Error details:
++ Please provide this error message when contacting support, as it will help us + diagnose the issue at hand. +
+
+
+ {currentUrl}, {error?.message}
+
+