fix: handle document download and clipboard copy failures

Two unguarded async calls silently swallowed errors: document download
used a bare "void downloadDocument(...)" with no catch, so a failed
download (network error, expired session) did nothing visible; the
webhook secret copy button had no try/catch around
navigator.clipboard.writeText, which can throw on denied permission or
an insecure context. Both now show a toast on failure.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-09 11:31:15 +02:00
1 parent 4ec1468eb4
commit de5df72491
2 files changed
+12 -4

No files matched your search

@@ -75,9 +75,13 @@ export function CreateWebhookDialog() {
async function copySecret() { async function copySecret() {
if (!createdSecret) return; if (!createdSecret) return;
await navigator.clipboard.writeText(createdSecret); try {
setCopied(true); await navigator.clipboard.writeText(createdSecret);
toast.success("Secret kopiert"); setCopied(true);
toast.success("Secret kopiert");
} catch {
toast.error("Secret konnte nicht kopiert werden");
}
} }
return ( return (
@@ -129,7 +129,11 @@ export function DocumentUploadCard({
<Button <Button
size="sm" size="sm"
variant="outline" variant="outline"
onClick={() => void downloadDocument(document.id, document.fileName)} onClick={() => {
downloadDocument(document.id, document.fileName).catch(() =>
toast.error("Datei konnte nicht heruntergeladen werden"),
);
}}
> >
Herunterladen Herunterladen
</Button> </Button>