web/app/error.tsxblame
View source
9e346cc1"use client";
9e346cc2
9e346cc3import { useEffect } from "react";
9e346cc4
9e346cc5export default function ErrorBoundary({
9e346cc6 error,
9e346cc7 reset,
9e346cc8}: {
9e346cc9 error: Error & { digest?: string };
9e346cc10 reset: () => void;
9e346cc11}) {
9e346cc12 useEffect(() => {
9e346cc13 fetch("/api/dev-errors", {
9e346cc14 method: "POST",
9e346cc15 headers: { "Content-Type": "application/json" },
9e346cc16 body: JSON.stringify({
9e346cc17 type: "react-error",
9e346cc18 message: error.message,
9e346cc19 stack: error.stack,
9e346cc20 digest: error.digest,
9e346cc21 url: window.location.href,
9e346cc22 }),
9e346cc23 }).catch(() => {});
9e346cc24 }, [error]);
9e346cc25
9e346cc26 return (
9e346cc27 <div className="max-w-3xl mx-auto px-4 py-16">
9e346cc28 <h1 className="text-lg" style={{ color: "var(--text-secondary)" }}>
9e346cc29 Something went wrong
9e346cc30 </h1>
9e346cc31 <p
9e346cc32 className="text-sm mt-1 mb-4"
9e346cc33 style={{ color: "var(--text-muted)" }}
9e346cc34 >
9e346cc35 {error.message}
9e346cc36 </p>
9e346cc37 <button
9e346cc38 onClick={reset}
9e346cc39 className="text-sm px-3 py-1.5"
9e346cc40 style={{
9e346cc41 color: "var(--accent)",
9e346cc42 border: "1px solid var(--border-subtle)",
9e346cc43 }}
9e346cc44 >
9e346cc45 Try again
9e346cc46 </button>
9e346cc47 </div>
9e346cc48 );
9e346cc49}