-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy patherror.tsx
More file actions
53 lines (41 loc) · 1.46 KB
/
error.tsx
File metadata and controls
53 lines (41 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use client';
import { useTranslations } from 'next-intl';
import Button from '#site/components/Common/Button';
import GlowingBackdropLayout from '#site/layouts/GlowingBackdrop';
import { SHOW_ERROR_DETAILS } from '#site/next.constants.mjs';
import type { FC } from 'react';
type ErrorPageProps = {
error: Error & { digest?: string };
};
const ErrorPage: FC<ErrorPageProps> = ({ error }) => {
const t = useTranslations();
const errorDetails = [
error.message,
error.digest && `digest: ${error.digest}`,
]
.filter(Boolean)
.join('\n');
return (
<GlowingBackdropLayout kind="default">
<span>500</span>
<h1 className="special -mt-4 text-center">
{t('layouts.error.internalServerError.title')}
</h1>
<p className="-mt-4 max-w-sm text-center text-lg">
{t('layouts.error.internalServerError.description')}
</p>
{SHOW_ERROR_DETAILS && errorDetails && (
<details className="max-w-2xl rounded-lg border border-neutral-300 bg-neutral-950/90 px-4 py-3 text-left text-neutral-50">
<summary className="cursor-pointer font-medium">
{t('layouts.error.details')}
</summary>
<pre className="mt-3 overflow-x-auto font-mono text-xs leading-6 break-words whitespace-pre-wrap">
{errorDetails}
</pre>
</details>
)}
<Button href="/">{t('layouts.error.backToHome')}</Button>
</GlowingBackdropLayout>
);
};
export default ErrorPage;