'use client'; import { useEffect } from 'react'; export default function GlobalError({ error, reset, }: { error: Error & { digest?: string }; reset: () => void; }) { useEffect(() => { // Report to error tracking service in production; log digest only if (process.env.NODE_ENV === 'production') { // TODO: integrate with Sentry/Datadog when available // errorReporter.captureException(error); } else { console.error('Unhandled error:', error); } }, [error]); return (
Rất tiếc, đã có lỗi xảy ra. Vui lòng thử lại.
{error.digest && (Mã lỗi: {error.digest}
)}