import Translate, { translate } from '@docusaurus/Translate'; import clsx from 'clsx'; import styles from './ErrorMessage.module.css'; /** An app's own error UI (unlike ErrorPanel, which is playground chrome). * Matches the props of AsyncBoundary's `errorComponent` */ export function ErrorMessage({ error, resetErrorBoundary, className, }: { error: Error & { status?: number }; resetErrorBoundary?: () => void; className?: string; }) { return (
{error.status ? translate( { id: 'playground.errorMessage.status', message: 'Request failed ({status})', }, { status: error.status }, ) : error.name}
{error.message}
{resetErrorBoundary && ( )}
); }