_error.jsx 572 B

1234567891011121314151617
  1. import * as Sentry from '@sentry/nextjs'
  2. import Error from 'next/error'
  3. const CustomErrorComponent = (props) => {
  4. return <Error statusCode={props.statusCode} />
  5. }
  6. CustomErrorComponent.getInitialProps = async (contextData) => {
  7. // In case this is running in a serverless function, await this in order to give Sentry
  8. // time to send the error before the lambda exits
  9. await Sentry.captureUnderscoreErrorException(contextData)
  10. // This will contain the status code of the response
  11. return Error.getInitialProps(contextData)
  12. }
  13. export default CustomErrorComponent