import { useEffect, useState } from 'react'; import { useLocalization } from '../hooks'; import { Button, Link } from '../components'; import { ROUTES } from 'routes'; export default function PzErrorPage({ error, reset }: { error: Error & { digest?: string; isServerError?: boolean }; reset: () => void; }) { const [isServerError, setIsServerError] = useState(false); useEffect(() => { if ('isServerError' in error) { setIsServerError(true); return; } setIsServerError(!!error.digest); }, [error]); return isServerError ? ( ) : ( ); } function ClientErrorUI({ error, reset }: { error: Error & { digest?: string }; reset: () => void; }) { const { t } = useLocalization(); const errorMessage = error?.message || 'Unknown error'; return ( 500 {t('common.client_error.title')} {t('common.client_error.description')} Error: {errorMessage} {t('common.client_error.link_text')} {t('common.try_again')} ); } function ServerErrorUI() { const { t } = useLocalization(); const reloadPage = () => { window.location.reload(); }; return ( 500 {t('common.page_500.title')} {t('common.page_500.description')} {t('common.page_500.link_text')} {t('common.try_again')} ); }
{t('common.client_error.description')}
Error: {errorMessage}
{t('common.page_500.description')}