feat: add catch all error boundary
This commit is contained in:
+6
-1
@@ -3,6 +3,11 @@
|
||||
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"],
|
||||
"rules": {
|
||||
"no-console": "warn",
|
||||
"prettier/prettier": "error"
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'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,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">
|
||||
|
||||
Reference in New Issue
Block a user