import React from 'react' import getConfig from 'next/config' const {publicRuntimeConfig} = getConfig() const ErrorPage = ({error}) => { const env = publicRuntimeConfig.SOS_ENV if (!error) return ( <>
This page was not found
> ) return ( <>{error.message}
{env === 'development' && ( <> {error.stack && (
{error.stack})}
{JSON.stringify(error, null, 2)}> )} > ) } ErrorPage.getInitialProps = ({ctx: {err, req, res}}) => { if(!err) return {error: null} if(res) err.status = res.statusCode return { error: err } } export default ErrorPage