"use client"; import { useEffect } from "react"; // Error boundary for the authenticated (app) segment. Catches render/runtime // errors in any /(app) page (home, ai, growth, …), shows a friendly recovery // UI, and reports the crash to /api/errors for the admin error tracker. export default function AppError({ error, reset, }: { error: Error & { digest?: string }; reset: () => void; }) { useEffect(() => { try { fetch("/api/errors", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: error?.message || "Unknown app error", stack: error?.stack, digest: error?.digest, url: typeof window !== "undefined" ? window.location.pathname : undefined, level: "error", metadata: { boundary: "app" }, }), keepalive: true, }).catch(() => {}); } catch {} }, [error]); return (
This screen hit an unexpected error. It's been reported automatically.