import { AlertTriangle, RefreshCw } from "lucide-react"; import { Button } from "@/components/ui/button"; import { ApiClientError } from "@/services/api-client"; interface ErrorStateProps { error: Error; title?: string; onRetry?: () => void; } function getHint(error: Error): string | null { if (!(error instanceof ApiClientError)) return null; const { status } = error; if (status === 401 || status === 403) { return "Please check your AccessKey credentials in the project settings."; } if (status === 503 || error.code === "NETWORK_ERROR") { return "The service may be unreachable. Verify the endpoint address and network connectivity."; } return null; } export function ErrorState({ error, title, onRetry }: ErrorStateProps) { const hint = getHint(error); return (

{title ?? "Failed to load data"}

{error.message}

{hint && (

{hint}

)} {!hint &&
} {onRetry && ( )}
); }