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
21 lines
664 B
JavaScript
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 (
|
|
<>
|
|
<h2>{error.name || defaults.title}</h2>
|
|
<p>{error.message || defaults.message}</p>
|
|
{process.env.NODE_ENV === 'development' && (
|
|
<pre>
|
|
{JSON.stringify(error, null, 2)}
|
|
</pre>
|
|
)}
|
|
</>
|
|
)
|
|
}
|