diff --git a/src/App.tsx b/src/App.tsx
index 690a29d7..97a99e2c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -7,32 +7,38 @@ import JsonStoreView from './components/json_store_view'
import MdxTemplateView from './components/mdx_template_view'
import RootLayout from './components/root_layout'
import templatesConfig from './templates/templates_config'
-import TemplateEditor from "./components/editor";
-import Home from "./components/home";
-import JobsView from "./components/jobs_view";
+import TemplateEditor from "./components/editor"
+import Home from "./components/home"
+import JobsView from "./components/jobs_view"
+import RouterErrorElement from "./components/error"
// Routes to be used by React Router, which handles all the
// browser routing within this domain.
const routes = [{
path: "/",
- element:
+ element: ,
+ RouterErrorElement: ,
},{
path: "/template_editor",
element: ,
+ RouterErrorElement: ,
},
].concat(Object.keys(templatesConfig).flatMap(dbName => [{
path: `/app/${dbName}`,
// TODO: Create a component that provides the functionality
// to manage the documents in this DB
element:
,
+ RouterErrorElement: ,
},
{
path: `/app/${dbName}/:docId`,
element: ,
+ RouterErrorElement: ,
},
{
path: `/app/${dbName}/:docId/json`,
element: ,
+ RouterErrorElement: ,
}
]))
diff --git a/src/components/error.tsx b/src/components/error.tsx
new file mode 100644
index 00000000..7015067d
--- /dev/null
+++ b/src/components/error.tsx
@@ -0,0 +1,23 @@
+import React, { FC } from "react"
+
+/*
+This element provides a fallback state for the router element
+It is displayed when the router encounters an error and cannot render the requested page
+This should be used when there is no other way to recover from the error and a component fails to render
+*/
+const RouterErrorElement: FC = () => {
+ return (
+
+
An Unexpected Error Has Occurred
+
+ To recover, try the following:
+
+
+
+ )
+}
+
+export default RouterErrorElement
\ No newline at end of file
diff --git a/src/components/root_layout.tsx b/src/components/root_layout.tsx
index d1187bee..becca93b 100644
--- a/src/components/root_layout.tsx
+++ b/src/components/root_layout.tsx
@@ -6,6 +6,7 @@ import Image from 'react-bootstrap/Image'
import NavBar from 'react-bootstrap/NavBar'
import { useLocation, Link } from "react-router-dom";
import { Button } from 'react-bootstrap';
+import DisplayErrorErrorBoundary from './display_error_error_boundary';
interface RootLayoutProps {
children: React.ReactNode,
@@ -65,9 +66,11 @@ return (
-
- {children}
-
+
+
+ {children}
+
+
);