From b6c1d88c32a7c0734470f5ab5c15d16c5f2494cd Mon Sep 17 00:00:00 2001 From: Dominik Stumpf Date: Mon, 25 Nov 2024 20:49:58 +0100 Subject: [PATCH] feat: add error and not found page, provided by nextjs example --- src/app/error.tsx | 33 +++++++++++++++++++++++++++++++++ src/app/not-found.tsx | 11 +++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/app/error.tsx create mode 100644 src/app/not-found.tsx diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 0000000000..a34504181b --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { useEffect } from "react"; + +const ErrorBoundary = ({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) => { + useEffect(() => { + // Log the error to an error reporting service + console.error(error); + }, [error]); + + return ( +
+

Something went wrong!

+ +
+ ); +}; + +export default ErrorBoundary; diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 0000000000..3440a40d18 --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,11 @@ +import Link from "next/link"; + +export default function NotFound() { + return ( +
+

Not Found

+

Could not find requested resource

+ Return Home +
+ ); +}