From 81c6d69a5e53474786fc42e6a0079cb54158287a Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:53:41 -0500 Subject: [PATCH] feat: add catch all error boundary --- .eslintrc.json | 7 ++++++- src/app/error.tsx | 24 ++++++++++++++++++++++++ src/app/page.tsx | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/app/error.tsx diff --git a/.eslintrc.json b/.eslintrc.json index 76c069e..05dcbe8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,11 @@ "extends": ["next/core-web-vitals", "plugin:prettier/recommended"], "rules": { "no-console": "warn", - "prettier/prettier": "error" + "prettier/prettier": [ + "error", + { + "endOfLine": "auto" + } + ] } } diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 0000000..c673ea9 --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,24 @@ +'use client'; +export default function Error({ + error, + reset, +}: { + error: Error; + reset: () => void; +}) { + return ( +
+
+

+ Oops it looks like we've run into an issue. +

+ +
+
+ ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index ce81220..3a82499 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,6 +1,7 @@ import AllPosts from '@/components/AllPosts'; export default function Home() { + throw Error(); return (