added error boundaries

This commit is contained in:
Joonas 2023-01-16 17:18:57 +02:00
parent eeb0991d35
commit 704abe7392
3 changed files with 31 additions and 0 deletions

View File

@ -236,3 +236,16 @@ export default function Index() {
</Overlay>
);
}
export function ErrorBoundary({ error }) {
console.log(error);
return (
<Overlay>
<div className="w-full rounded bg-ctp-red p-4 text-white">
<h1 className="text-2xl">{error.message}</h1>
<code>{error.stack}</code>
</div>
</Overlay>
);
}

5
app/routes/threads/$.jsx Normal file
View File

@ -0,0 +1,5 @@
import { redirect } from "@remix-run/node";
export function loader() {
return redirect("/");
}

View File

@ -311,3 +311,16 @@ export default function Thread() {
</Overlay>
);
}
export function ErrorBoundary({ error }) {
console.log(error);
return (
<Overlay>
<div className="w-full rounded bg-ctp-red p-4 text-white">
<h1 className="text-2xl">{error.message}</h1>
<code>{error.stack}</code>
</div>
</Overlay>
);
}