1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix status messages on error (#1131)

* fix status messages on error

* error: use the special message for 404
This commit is contained in:
Naoyuki Kanezawa 2017-02-15 00:15:42 +09:00 committed by Tim Neutkens
parent fb8f050667
commit 45e77d535f
2 changed files with 3 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import HTTPStatus from 'http-status'
import Head from './head' import Head from './head'
export default class Error extends React.Component { export default class Error extends React.Component {
@ -11,7 +12,7 @@ export default class Error extends React.Component {
const { statusCode } = this.props const { statusCode } = this.props
const title = statusCode === 404 const title = statusCode === 404
? 'This page could not be found' ? 'This page could not be found'
: (statusCode ? 'Internal Server Error' : 'An unexpected error has occurred') : HTTPStatus[statusCode] || 'An unexpected error has occurred'
return <div style={styles.error}> return <div style={styles.error}>
<Head> <Head>

View file

@ -65,6 +65,7 @@
"glamor": "2.20.23", "glamor": "2.20.23",
"glob-promise": "3.1.0", "glob-promise": "3.1.0",
"htmlescape": "1.1.1", "htmlescape": "1.1.1",
"http-status": "1.0.1",
"is-windows-bash": "1.0.3", "is-windows-bash": "1.0.3",
"json-loader": "0.5.4", "json-loader": "0.5.4",
"loader-utils": "0.2.16", "loader-utils": "0.2.16",