mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Remove pageNotFound key from the error.
This commit is contained in:
parent
866319c76d
commit
6f9b51fce6
|
@ -5,13 +5,12 @@ import Head from './head'
|
|||
export default class Error extends React.Component {
|
||||
static getInitialProps ({ res, err }) {
|
||||
const statusCode = res ? res.statusCode : (err ? err.statusCode : null)
|
||||
const pageNotFound = statusCode === 404 || (err ? err.pageNotFound : false)
|
||||
return { statusCode, pageNotFound }
|
||||
return { statusCode }
|
||||
}
|
||||
|
||||
render () {
|
||||
const { statusCode, pageNotFound } = this.props
|
||||
const title = pageNotFound
|
||||
const { statusCode } = this.props
|
||||
const title = statusCode === 404
|
||||
? 'This page could not be found'
|
||||
: HTTPStatus[statusCode] || 'An unexpected error has occurred'
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ export default class Router {
|
|||
return { error: err }
|
||||
}
|
||||
|
||||
if (err.pageNotFound) {
|
||||
if (err.statusCode === 404) {
|
||||
// Indicate main error display logic to
|
||||
// ignore rendering this error as a runtime error.
|
||||
err.ignore = true
|
||||
|
|
|
@ -124,7 +124,6 @@ export async function renderScriptError (req, res, page, error, customFields, op
|
|||
res.end(`
|
||||
function loadPage () {
|
||||
var error = new Error('Page not exists: ${page}')
|
||||
error.pageNotFound = true
|
||||
error.statusCode = 404
|
||||
__NEXT_PAGE_LOADER__.registerPage('${page}', function(cb) {
|
||||
cb(error)
|
||||
|
|
Loading…
Reference in a new issue