From b70b91deceab1a06a1abb2b8c4d167bb780b86ff Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Sat, 17 Jan 2026 15:50:43 +0000 Subject: [PATCH] Generated by Spark: Fix all reported errors. --- src/ErrorFallback.tsx | 223 +++++++++++++++++++++--------------------- 1 file changed, 110 insertions(+), 113 deletions(-) diff --git a/src/ErrorFallback.tsx b/src/ErrorFallback.tsx index 560fcd6..3cb1b57 100644 --- a/src/ErrorFallback.tsx +++ b/src/ErrorFallback.tsx @@ -1,113 +1,110 @@ -import { useState } from "react"; -import { Alert, AlertTitle, AlertDescription } from "./components/ui/alert"; -import { Button } from "./components/ui/button"; -import { AIErrorHelper } from "./components/AIErrorHelper"; -import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/ui/collapsible"; - -import { AlertTriangleIcon, RefreshCwIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon, CheckIcon } from "lucide-react"; - - if (import.meta.env.DEV) throw error; - const [isStackOpen, setIsStackOpen] = - - const errorDetails = `Error: ${error.message}\n\nSta - setCopied(true); - - return ( -
- navigator.clipboard.writeText(errorDetails); - setCopied(true); - setTimeout(() => setCopied(false), 2000); - }; - - return ( -
-
- - - This spark has encountered a runtime error - - Something unexpected happened while running the application. The error details are shown below. Contact the spark author and let them know about this issue. - - - - {copied ? ( - - - <> - Copy All - )} -
- {error.message} - - - - - - - )} -
- - ); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +import { useState } from "react"; +import { Alert, AlertTitle, AlertDescription } from "./components/ui/alert"; +import { Button } from "./components/ui/button"; +import { AIErrorHelper } from "./components/AIErrorHelper"; +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/ui/collapsible"; +import { AlertTriangleIcon, RefreshCwIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon, CheckIcon } from "lucide-react"; + +interface ErrorFallbackProps { + error: Error; + resetErrorBoundary: () => void; +} + +export function ErrorFallback({ error, resetErrorBoundary }: ErrorFallbackProps) { + if (import.meta.env.DEV) throw error; + + const [isStackOpen, setIsStackOpen] = useState(false); + const [copied, setCopied] = useState(false); + + const errorDetails = `Error: ${error.message}\n\nStack Trace:\n${error.stack || 'No stack trace available'}`; + + const handleCopy = () => { + navigator.clipboard.writeText(errorDetails); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }; + + return ( +
+
+ + + This spark has encountered a runtime error + + Something unexpected happened while running the application. The error details are shown below. Contact the spark author and let them know about this issue. + + + +
+
+

Error Message

+ +
+ +

+ {error.message} +

+ + + + + + +
+
+                  {error.stack || 'No stack trace available'}
+                
+
+
+
+
+ +
+ + + +
+
+
+ ); +}