34 lines
631 B
TypeScript
34 lines
631 B
TypeScript
"use client"
|
|
|
|
import * as Sentry from "@sentry/nextjs"
|
|
import { useEffect } from "react"
|
|
import { useIntl } from "react-intl"
|
|
|
|
export default function Error({
|
|
error,
|
|
}: {
|
|
error: Error & { digest?: string }
|
|
}) {
|
|
const intl = useIntl()
|
|
|
|
useEffect(() => {
|
|
if (!error) return
|
|
|
|
console.error({ breadcrumbsError: error })
|
|
Sentry.captureException(error)
|
|
}, [error])
|
|
|
|
return (
|
|
<p>
|
|
<strong>
|
|
{intl.formatMessage(
|
|
{ id: "Breadcrumbs failed for this page ({errorId})" },
|
|
{
|
|
errorId: `${error.digest}@${Date.now()}`,
|
|
}
|
|
)}
|
|
</strong>
|
|
</p>
|
|
)
|
|
}
|