MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / ErrorCard

Function ErrorCard

packages/web/src/app/error.tsx:63–120  ·  view source on GitHub ↗
({ message, errorCode, statusCode, onReloadButtonClicked }: ErrorCardProps)

Source from the content-addressed store, hash-verified

61}
62
63function ErrorCard({ message, errorCode, statusCode, onReloadButtonClicked }: ErrorCardProps) {
64 const [copied, setCopied] = useState<string | null>(null)
65
66 const copyToClipboard = (text: string, field: string) => {
67 navigator.clipboard.writeText(text)
68 setCopied(field)
69 setTimeout(() => setCopied(null), 2000)
70 }
71
72 return (
73 <Card className="w-full max-w-md mx-auto">
74 <CardHeader className="space-y-1 flex">
75 <CardTitle className="text-2xl font-bold flex items-center gap-2 text-destructive">
76 <TriangleAlert className="h-5 w-5 mt-0.5" />
77 Unexpected Error
78 </CardTitle>
79 <CardDescription className="text-sm">
80 An unexpected error occurred. Please reload the page and try again. If the issue persists, <Link href={`mailto:${SOURCEBOT_SUPPORT_EMAIL}?subject=Sourcebot%20Error%20Report${errorCode ? `%20|%20Code:%20${errorCode}` : ''}`} className='underline'>please contact us</Link>.
81 </CardDescription>
82 </CardHeader>
83 <CardContent className="space-y-4">
84 <div className="space-y-3">
85 <ErrorField
86 label="Error Message"
87 value={message}
88 onCopy={() => copyToClipboard(message, "message")}
89 copied={copied === "message"}
90 />
91
92 {errorCode && (
93 <ErrorField
94 label="Error Code"
95 value={errorCode}
96 onCopy={() => copyToClipboard(errorCode.toString(), "errorCode")}
97 copied={copied === "errorCode"}
98 />
99 )}
100
101 {statusCode && (
102 <ErrorField
103 label="Status Code"
104 value={statusCode}
105 onCopy={() => copyToClipboard(statusCode.toString(), "statusCode")}
106 copied={copied === "statusCode"}
107 />
108 )}
109 </div>
110 <Button
111 onClick={onReloadButtonClicked}
112 variant='outline'
113 className='w-full'
114 >
115 Reload Page
116 </Button>
117 </CardContent>
118 </Card>
119 )
120}

Callers

nothing calls this directly

Calls 1

copyToClipboardFunction · 0.85

Tested by

no test coverage detected