({ error }: Route.ErrorBoundaryProps)
| 39 | } |
| 40 | |
| 41 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected