-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.tsx
More file actions
41 lines (38 loc) · 1.11 KB
/
error.tsx
File metadata and controls
41 lines (38 loc) · 1.11 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
"use client"; // Error boundaries must be Client Components
import clsx from "clsx";
import { ChatAreaContainer } from "./chat/[chatId]/chatArea";
import { useEffect, useState } from "react";
import { captureException } from "@sentry/nextjs";
export default function Error({
error,
// reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
const [eventId, setEventId] = useState<string>();
useEffect(() => {
setEventId(captureException(error));
}, [error]);
return (
<ChatAreaContainer chatId={"error"}>
<p>ページの読み込み中にエラーが発生しました。</p>
<pre
className={clsx(
"border-2 border-current/20 mt-4 rounded-box p-4! bg-base-300! text-base-content!",
"max-w-full whitespace-pre-wrap"
)}
>
{error.message}
</pre>
{error.digest && (
<p className="mt-2 text-sm text-base-content/50">
Digest: {error.digest}
</p>
)}
{eventId && (
<p className="mt-2 text-sm text-base-content/50">eventID: {eventId}</p>
)}
</ChatAreaContainer>
);
}