MCPcopy Create free account
hub / github.com/composify-js/composify / ErrorBoundary

Function ErrorBoundary

examples/react-router/app/root.tsx:41–65  ·  view source on GitHub ↗
({ error }: Route.ErrorBoundaryProps)

Source from the content-addressed store, hash-verified

39}
40
41export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
42 let message = 'Oops!';
43 let details = 'An unexpected error occurred.';
44 let stack: string | undefined;
45
46 if (isRouteErrorResponse(error)) {
47 message = error.status === 404 ? '404' : 'Error';
48 details = error.status === 404 ? 'The requested page could not be found.' : error.statusText || details;
49 } else if (import.meta.env.DEV && error && error instanceof Error) {
50 details = error.message;
51 stack = error.stack;
52 }
53
54 return (
55 <main className="pt-16 p-4 container mx-auto">
56 <h1>{message}</h1>
57 <p>{details}</p>
58 {stack && (
59 <pre className="w-full p-4 overflow-x-auto">
60 <code>{stack}</code>
61 </pre>
62 )}
63 </main>
64 );
65}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected