diff --git a/eduaid_web/src/App.js b/eduaid_web/src/App.js
index e9eef0a0..8784f1ef 100644
--- a/eduaid_web/src/App.js
+++ b/eduaid_web/src/App.js
@@ -1,23 +1,26 @@
import "./App.css";
import { Routes, Route, HashRouter } from "react-router-dom";
import Home from "./pages/Home";
-import Question_Type from "./pages/Question_Type";
-import Text_Input from "./pages/Text_Input";
+import QuestionType from "./pages/Question_Type";
+import TextInput from "./pages/Text_Input";
import Output from "./pages/Output";
import Previous from "./pages/Previous";
import NotFound from "./pages/PageNotFound";
+import ErrorBoundary from "./utils/ErrorBoundary";
function App() {
return (
-
- } />
- } />
- } />
- } />
- } />
- } />
-
+
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
);
}
diff --git a/eduaid_web/src/utils/ErrorBoundary.js b/eduaid_web/src/utils/ErrorBoundary.js
new file mode 100644
index 00000000..c74b1936
--- /dev/null
+++ b/eduaid_web/src/utils/ErrorBoundary.js
@@ -0,0 +1,58 @@
+import React from "react";
+
+class ErrorBoundary extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { hasError: false };
+ }
+
+ static getDerivedStateFromError(error) {
+ return { hasError: true };
+ }
+
+ componentDidCatch(error, errorInfo) {
+ console.error("ErrorBoundary caught an error:", error, errorInfo);
+ }
+
+ handleRetry = () => {
+ window.location.reload();
+ };
+
+ render() {
+ if (this.state.hasError) {
+ return (
+
+
Something went wrong.
+
+
+ );
+ }
+
+ return this.props.children;
+ }
+}
+
+export default ErrorBoundary;