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.

21 lines
664 B
JavaScript

5 years ago
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"}
}
5 years ago
export default function ErrorDisplay({error}){
5 years ago
const defaults = errorMessages[error.status]
5 years ago
return (
<>
5 years ago
<h2>{error.name || defaults.title}</h2>
<p>{error.message || defaults.message}</p>
{process.env.NODE_ENV === 'development' && (
<pre>
{JSON.stringify(error, null, 2)}
</pre>
)}
5 years ago
</>
)
}