Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 19x 3x 3x | import type { ReactElement } from 'react'
import { Button } from '@/components/Button'
import { ApiRequestError } from '@/lib/api'
interface RouteErrorProps {
error: unknown
reset: () => void
}
// The router's default error screen. The request id is what a person quotes when they report it (design G5).
export const RouteError = ({ error, reset }: RouteErrorProps): ReactElement => {
const requestId = error instanceof ApiRequestError ? error.requestId : null
return (
<div role="alert" className="flex flex-col items-start gap-3 p-6">
<p className="text-lg font-semibold">Something went wrong.</p>
{requestId ? (
<p className="text-sm text-muted-foreground">{`Request id: ${requestId}`}</p>
) : null}
<Button variant="outline" onClick={reset}>
Try again
</Button>
</div>
)
}
|