diff --git a/frontend/app/error.tsx b/frontend/app/error.tsx new file mode 100644 index 0000000..811f76e --- /dev/null +++ b/frontend/app/error.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { useEffect } from "react"; + +interface ErrorPageProps { + error: Error & { digest?: string }; + reset: () => void; +} + +export default function ErrorPage({ error, reset }: ErrorPageProps) { + useEffect(() => { + // Log the error to an error reporting service + console.error(error); + }, [error]); + + return ( +
+
+
+

500 |

+

Internal Server Error

+
+ +

+ We're having trouble right now. Please refresh the page or try again + later. +

+
+ + +
+
+
+ ); +} diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 1cb1785..6a70565 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -4,4 +4,4 @@ export default function Home() {

HomePage

); -} \ No newline at end of file +} diff --git a/frontend/app/test-error/page.tsx b/frontend/app/test-error/page.tsx new file mode 100644 index 0000000..090aebc --- /dev/null +++ b/frontend/app/test-error/page.tsx @@ -0,0 +1,28 @@ +"use client"; + +import { useState } from "react"; + +export default function TestErrorPage() { + const [shouldThrow, setShouldThrow] = useState(false); + + if (shouldThrow) { + throw new Error("This is a test error to demonstrate the error page!"); + } + + return ( +
+
+

Error Page Test

+

+ Click the button below to trigger an error and test the error page: +

+ +
+
+ ); +} diff --git a/frontend/package.json b/frontend/package.json index 81b3864..4be5af9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,8 @@ "test": "jest" }, "dependencies": { + "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query-devtools": "^5.90.2", "next": "15.5.4", "react": "19.1.0", "react-dom": "19.1.0"