import React from 'react' import PropTypes from 'prop-types' import HTTPStatus from 'http-status' import Head from 'next-server/head' export default class Error extends React.Component { static displayName = 'ErrorPage' static getInitialProps ({ res, err }) { 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' return (
{statusCode}: {title}