"use client"; import { Icon } from "@iconify/react"; import * as Sentry from "@sentry/nextjs"; import { useEffect } from "react"; import { Button } from "@/components/shadcn"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/shadcn/card/card"; import { CustomLink } from "@/components/ui/custom/custom-link"; import { SentryErrorSource, SentryErrorType } from "@/sentry"; export default function Error({ error, reset, }: { error: Error & { digest?: string }; reset: () => void; }) { useEffect(() => { // Check if it's a 500 error const is500Error = error.message?.includes("500") || error.message?.includes("502") || error.message?.includes("503") || error.message?.toLowerCase().includes("server error"); if (is500Error) { // Log 500 errors specifically for monitoring console.error("Server error detected:", { message: error.message, digest: error.digest, timestamp: new Date().toISOString(), }); // Send to Sentry with high priority Sentry.captureException(error, { tags: { error_boundary: "app", error_type: SentryErrorType.SERVER_ERROR, error_source: SentryErrorSource.ERROR_BOUNDARY, status_code: "500", digest: error.digest, }, level: "error", fingerprint: ["server-error", error.message], contexts: { error_details: { is_server_error: true, timestamp: new Date().toISOString(), }, }, }); } else { console.error("Application error:", error); // Send other errors to Sentry with normal priority Sentry.captureException(error, { tags: { error_boundary: "app", error_type: SentryErrorType.APPLICATION_ERROR, error_source: SentryErrorSource.ERROR_BOUNDARY, digest: error.digest, }, level: "warning", fingerprint: ["app-error", error.message], }); } }, [error]); const is500Error = error.message?.includes("500") || error.message?.includes("502") || error.message?.includes("503") || error.message?.toLowerCase().includes("server error"); return (