Skip to content

Commit 45e77d5

Browse files
nkzawatimneutkens
authored andcommitted
Fix status messages on error (#1131)
* fix status messages on error * error: use the special message for 404
1 parent fb8f050 commit 45e77d5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/error.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import HTTPStatus from 'http-status'
23
import Head from './head'
34

45
export default class Error extends React.Component {
@@ -11,7 +12,7 @@ export default class Error extends React.Component {
1112
const { statusCode } = this.props
1213
const title = statusCode === 404
1314
? 'This page could not be found'
14-
: (statusCode ? 'Internal Server Error' : 'An unexpected error has occurred')
15+
: HTTPStatus[statusCode] || 'An unexpected error has occurred'
1516

1617
return <div style={styles.error}>
1718
<Head>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"glamor": "2.20.23",
6666
"glob-promise": "3.1.0",
6767
"htmlescape": "1.1.1",
68+
"http-status": "1.0.1",
6869
"is-windows-bash": "1.0.3",
6970
"json-loader": "0.5.4",
7071
"loader-utils": "0.2.16",

0 commit comments

Comments
 (0)