"use client"; /* The last resort: the root layout itself failed, so this replaces entirely. Nothing from the app is available here — not the font, not globals.css, not the site components — so every style is inline and the type falls back to a system stack rather than Archivo. Keeping it self-contained is the point: this page has to render when everything else has not. */ import { useEffect } from "react"; import { safeLocation } from "@/lib/errors"; import { report } from "@/lib/glitchtip"; const INK = "#201e1d"; const PAPER = "#f3f2f2"; const ACCENT = "#ec3013"; const SANS = "system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"; export default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { /* Reported straight to the reporter, not through lib/errors' window seam. * * That seam is published by components/ErrorReporting, which is mounted inside the root layout — * the very layout that has just failed. When this boundary renders, that effect has by definition * not run, so window.__tcReporter is undefined and reportError falls through to a no-op in * production: the one boundary that means "everything is broken" was the only one sending * nothing. Importing the reporter directly costs a couple of kilobytes in the bundle that renders * this page and removes the dependency on a component that cannot have mounted. */ useEffect(() => { report({ error, where: "global", url: safeLocation() }); }, [error]); return (
Something failed before the page could be built. Your records are untouched — this is the website falling over, not the linen room. Try again in a moment.
{error.digest ? (Reference {error.digest}
) : null}