import { AlertIcon } from '@primer/octicons-react' import { isRouteErrorResponse, useRouteError } from '@remix-run/react' import { cn } from '~/utils/cn' import Card from './Card' import Code from './Code' type Properties = { readonly type?: 'full' | 'embedded'; } export function ErrorPopup({ type = 'full' }: Properties) { const error = useRouteError() const routing = isRouteErrorResponse(error) const message = (error instanceof Error ? error.message : 'An unexpected error occurred') return (
{routing ? error.status : 'Error'}
{routing ? ( error.statusText ) : ( {message} )}
) }