mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
21 lines
487 B
JavaScript
21 lines
487 B
JavaScript
function CustomError(props) {
|
|
return (
|
|
<>
|
|
<div>My Custom {props.statusCode} page</div>
|
|
<div id="error-props">{JSON.stringify(props)}</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
CustomError.getInitialProps = ({ res, err, ...context }) => {
|
|
// 410 - GONE
|
|
if (res && context.asPath === '/my-custom-gone-path') {
|
|
res.statusCode = 410
|
|
}
|
|
|
|
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
|
|
return { statusCode, locale: context.locale }
|
|
}
|
|
|
|
export default CustomError
|