You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
606 B
JavaScript
34 lines
606 B
JavaScript
import React from 'react'
|
|
import getConfig from 'next/config'
|
|
|
|
const {publicRuntimeConfig} = getConfig()
|
|
|
|
const ErrorPage = ({error}) => {
|
|
const env = publicRuntimeConfig.SOS_ENV
|
|
if (!error)
|
|
return (
|
|
<>
|
|
<h2>Not Found</h2>
|
|
<p>We couldn't find the item you're looking for. Sorry!</p>
|
|
</>
|
|
)
|
|
|
|
return (
|
|
<>
|
|
<h2>{error.name}</h2>
|
|
<p>{error.message}</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
ErrorPage.getInitialProps = ({ctx: {err, req, res}}) => {
|
|
if(!err) return {error: null}
|
|
|
|
if(res)
|
|
err.status = res.statusCode
|
|
|
|
return { error: err }
|
|
}
|
|
|
|
export default ErrorPage
|