Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions examples/with-sentry/pages/_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => {
return <NextErrorComponent statusCode={statusCode} />
}

MyError.getInitialProps = async ({ res, err, asPath }) => {
MyError.getInitialProps = async ({ res, err }) => {
const errorInitialProps = await NextErrorComponent.getInitialProps({
res,
err,
Expand Down Expand Up @@ -48,13 +48,8 @@ MyError.getInitialProps = async ({ res, err, asPath }) => {
}

// If this point is reached, getInitialProps was called without any
// information about what the error might be. This is unexpected and may
// indicate a bug introduced in Next.js, so record it in Sentry
Sentry.captureException(
new Error(`_error.js getInitialProps missing data at path: ${asPath}`)
)
await Sentry.flush(2000)

// information about what the error might be. This can be caused by
// a falsy value being thrown e.g. throw undefined
return errorInitialProps
}

Expand Down