diff --git a/components/errorDisplay.js b/components/errorDisplay.js index 9c80f66..7053e0c 100644 --- a/components/errorDisplay.js +++ b/components/errorDisplay.js @@ -1,8 +1,20 @@ +const errorMessages = { + 404: {title: 'Page not found', message: 'Unfortunately that page could not be found. If you followed a link to get here, please let the owner of the link know that they need to update it.'}, + [undefined]: {title: 'Unknown error', message: "We're not exactly sure what happened"} +} + export default function ErrorDisplay({error}){ + const defaults = errorMessages[error.status] + return ( <> -
{error.message}
+{error.message || defaults.message}
+ {process.env.NODE_ENV === 'development' && ( ++ {JSON.stringify(error, null, 2)} ++ )} > ) } diff --git a/next.config.js b/next.config.js index cd3e512..cbe53ac 100644 --- a/next.config.js +++ b/next.config.js @@ -69,6 +69,7 @@ module.exports = withImages({ return config }, env: { - STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY + STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY, + NODE_ENV: process.env.NODE_ENV || 'development' } })