-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_error.tsx
31 lines (25 loc) · 1.19 KB
/
_error.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* This page is loaded by Nextjs:
* - on the server, when data-fetching methods throw or reject
* - on the client, when `getInitialProps` throws or rejects
* - on the client, when a React lifecycle method throws or rejects, and it's
* caught by the built-in Nextjs error boundary
*
* See:
* - https://nextjs.org/docs/basic-features/data-fetching/overview
* - https://nextjs.org/docs/api-reference/data-fetching/get-initial-props
* - https://reactjs.org/docs/error-boundaries.html
*/
import { captureUnderscoreErrorException } from '@sentry/nextjs'
import NextErrorComponent, { ErrorProps } from 'next/error'
import { NotFound } from '@pancakeswap/uikit'
const CustomErrorComponent = (props: ErrorProps) => <NotFound statusCode={props.statusCode} />
CustomErrorComponent.getInitialProps = async (contextData) => {
// In case this is running in a serverless function, await this in order to give Sentry
// time to send the error before the lambda exits
await captureUnderscoreErrorException(contextData)
// This will contain the status code of the response
return NextErrorComponent.getInitialProps(contextData)
}
CustomErrorComponent.chains = []
export default CustomErrorComponent