Files
Luigi ColombiGitHubkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
59564af9cb I18n context initial props (#21930)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-10 14:11:19 +02:00

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