feat: add catch all error boundary

This commit is contained in:
Stevan Freeborn
2023-09-16 11:53:41 -05:00
parent 60e587dc8a
commit 81c6d69a5e
3 changed files with 31 additions and 1 deletions
+6 -1
View File
@@ -3,6 +3,11 @@
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"],
"rules": {
"no-console": "warn",
"prettier/prettier": "error"
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
+24
View File
@@ -0,0 +1,24 @@
'use client';
export default function Error({
error,
reset,
}: {
error: Error;
reset: () => void;
}) {
return (
<div className="flex flex-col justify-center items-center flex-1">
<div className="flex flex-col items-center w-full max-w-4xl gap-4">
<h2 className="text-2xl">
Oops it looks like we&apos;ve run into an issue.
</h2>
<button
className="px-3 py-1 text-white bg-primary-accent rounded-md"
onClick={() => reset()}
>
Try again
</button>
</div>
</div>
);
}
+1
View File
@@ -1,6 +1,7 @@
import AllPosts from '@/components/AllPosts';
export default function Home() {
throw Error();
return (
<main className="flex flex-col items-center flex-1">
<div className="flex flex-col w-full max-w-4xl gap-4">