Error page fix
parent
4f16a0f8ea
commit
d3f4cd44ff
@ -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}){
|
export default function ErrorDisplay({error}){
|
||||||
|
const defaults = errorMessages[error.status]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>{error.name}</h1>
|
<h2>{error.name || defaults.title}</h2>
|
||||||
<p>{error.message}</p>
|
<p>{error.message || defaults.message}</p>
|
||||||
|
{process.env.NODE_ENV === 'development' && (
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify(error, null, 2)}
|
||||||
|
</pre>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue