diff --git a/packages/next/pages/_error.js b/packages/next/pages/_error.js index 3acc6d48..5bfeda6f 100644 --- a/packages/next/pages/_error.js +++ b/packages/next/pages/_error.js @@ -7,29 +7,38 @@ export default class Error extends React.Component { static displayName = 'ErrorPage' static getInitialProps ({ res, err }) { - const statusCode = res ? res.statusCode : (err ? err.statusCode : null) + const statusCode = + res && res.statusCode ? res.statusCode : err ? err.statusCode : 404 return { statusCode } } render () { const { statusCode } = this.props - const title = statusCode === 404 - ? 'This page could not be found' - : HTTPStatus[statusCode] || 'An unexpected error has occurred' + const title = + statusCode === 404 + ? 'This page could not be found' + : HTTPStatus[statusCode] || 'An unexpected error has occurred' - return
- - - {statusCode}: {title} - -
-