import * as Sentry from '@sentry/nextjs' import type { NextPageContext } from 'next' import NextError, { type ErrorProps } from 'next/error' import { useEffect, useRef } from 'react' export default function CustomError(props: ErrorProps) { const errorRef = useRef(null) useEffect(() => { errorRef.current?.focus() }, []) return (
) } CustomError.getInitialProps = async (context: NextPageContext) => { await Sentry.withScope(async (scope) => { scope.setTag('globalErrorBoundary', true) await Sentry.captureUnderscoreErrorException(context) }) return NextError.getInitialProps(context) }