"use client"

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

import { logger } from "@scandic-hotels/common/logger"

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

    logger.error("header", error)
    Sentry.captureException(error)
  }, [error])

  return null
}
