"use client"
import * as Sentry from "@sentry/nextjs"
import { useEffect } from "react"

export default function Error({
  error,
}: {
  error: Error & { digest?: string }
}) {
  useEffect(() => {
    if (!error) return

    console.error({ breadcrumbsError: error })
    Sentry.captureException(error)
  }, [error])

  return (
    <p>
      <strong>
        Breadcrumbs failed for this page ({error.digest}@{Date.now()})
      </strong>
    </p>
  )
}
