Files
buzz/app/(ui)/admin/error.tsx
T
dmgnr a31c8fbb54
Build and Push Image / build-backend (push) Successful in 52s
Build and Push Image / build-frontend (push) Successful in 2m8s
Build and Push Image / push (push) Successful in 1m24s
chore: oxc
2026-06-10 01:44:11 +07:00

40 lines
1.1 KiB
TypeScript
Executable File

"use client"; // Error boundaries must be Client Components
import { RefreshCw } from "lucide-react";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
export default function ErrorPage({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
const [loading, setLoading] = useState(false);
useEffect(() => {
// Log the error to an error reporting service
console.error(error);
}, [error]);
return (
<div className="m-2 ml-0 flex h-full w-full flex-col items-center justify-center gap-2 rounded-md border bg-[#2225] backdrop-blur-md">
<h2 className="text-2xl font-bold">Something went wrong!</h2>
<Button
onClick={
// Attempt to recover by trying to re-render the segment
() => {
setLoading(true);
setTimeout(() => reset(), 500);
}
}
disabled={loading}
>
{loading ? <Spinner /> : <RefreshCw />}
Try again
</Button>
</div>
);
}