diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..fc8fb4f --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { useEffect } from "react"; +import Link from "next/link"; + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error("Application error:", error); + }, [error]); + + return ( +
+ We're sorry, but something unexpected happened. Don't worry, + our practice exams are + still here waiting for you! +
+ + {/* Error Details (only in development) */} + {process.env.NODE_ENV === "development" && error.message && ( ++ {error.message} +
++ If this problem persists, please{" "} + + report it on GitHub + + . +
+Oh no... {error.message}
; + if (error) { + return ( ++ {error.message} +
+ ++ The exam questions could not be loaded. Please try again later or + select a different exam. +
+ ++
✅ {countAnswered}/{numberOfQuestions}
-+
{remainingTime}
+
Practice Exam help you practice skills, assess your knowledge, and identify the areas where you need additional preparation to accelerate your chances of succeeding on certification @@ -211,7 +281,7 @@ const Exam: NextPage<{ searchParams: { url: string; name: string } }> = ({ are likely to experience on Azure Fundamentals real exam.
+
This Practice Exam contains {numberOfQuestions} random questions (seen in upper left corner) and has a completion time limit of{" "} {remainingTime.split(":")[0]} minutes (seen in upper right @@ -221,7 +291,7 @@ const Exam: NextPage<{ searchParams: { url: string; name: string } }> = ({