-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathalways-exception.tsx
More file actions
39 lines (35 loc) · 1.02 KB
/
always-exception.tsx
File metadata and controls
39 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { LoadingIndicator } from "@/components/loading-indicator";
import { cn } from "@heroui/react";
import { ErrorToolCard } from "./error";
type AlwaysExceptionCardProps = {
message: string;
preparing: boolean;
animated: boolean;
};
const CardBody = ({ children }: { children: React.ReactNode }) => {
return <div className="tool-card">{children}</div>;
};
export const AlwaysExceptionCard = ({ message, preparing, animated }: AlwaysExceptionCardProps) => {
if (preparing) {
return (
<div className={cn("tool-card", { animated: animated })}>
<LoadingIndicator text="Making some exceptions ..." estimatedSeconds={20} />
</div>
);
}
try {
return (
<CardBody>
<div className="text-xs text-primary-600">{message}</div>
</CardBody>
);
} catch (error) {
return (
<ErrorToolCard
functionName="always_exception"
errorMessage={`Failed to parse always exception: ${error}, message: ${message}`}
animated={animated}
/>
);
}
};