MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / MyError

Function MyError

apps/web/pages/_error.tsx:4–14  ·  view source on GitHub ↗
({ statusCode, hasGetInitialPropsRun, err }: any)

Source from the content-addressed store, hash-verified

2import { NextPageContext } from 'next';
3
4const MyError = ({ statusCode, hasGetInitialPropsRun, err }: any) => {
5 if (!hasGetInitialPropsRun && err) {
6 // getInitialProps is not called in case of
7 // https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
8 // err via _app.js so it can be captured
9 console.error(err);
10 // Flushing is not required in this case as it only happens on the client
11 }
12
13 return <NextErrorComponent statusCode={statusCode} />;
14};
15
16MyError.getInitialProps = async (context: NextPageContext) => {
17 const errorInitialProps = (await NextErrorComponent.getInitialProps(

Callers

nothing calls this directly

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected