import { Button } from "@/src/components/ui/button"; import { AlertCircle } from "lucide-react"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useEffect } from "react"; import Link from "next/link"; import { captureException } from "@sentry/nextjs"; import { stripBasePath } from "@/src/utils/redirect"; export const ErrorPage = ({ title = "Error", message, additionalButton, }: { title?: string; message: string; additionalButton?: | { label: string; href: string; } | { label: string; onClick: () => void; }; }) => { const session = useSession(); const router = useRouter(); const newTargetPath = stripBasePath(router.asPath || "/"); // Only include targetPath if it's not the root (since "/" is the default anyway) const targetPathQuery = newTargetPath !== "/" ? `?targetPath=${encodeURIComponent(newTargetPath)}` : ""; return (
{message}