debug: add error boundary to show actual error message
This commit is contained in:
17
client/src/app/error.tsx
Normal file
17
client/src/app/error.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||||
|
useEffect(() => {
|
||||||
|
console.error("App error:", error);
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center gap-4 py-20">
|
||||||
|
<h2 className="text-xl font-bold">Fehler aufgetreten</h2>
|
||||||
|
<pre className="bg-base-200 rounded p-4 text-sm max-w-xl overflow-auto">{error.message}</pre>
|
||||||
|
<button className="btn btn-primary" onClick={reset}>Neu laden</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user