From de5df72491597c4f12eea17b706aec8186b393a9 Mon Sep 17 00:00:00 2001 From: Nick Szaunig Date: Wed, 9 Sep 2026 11:31:15 +0200 Subject: [PATCH] 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 --- .../settings/automation/create-webhook-dialog.tsx | 10 +++++++--- .../src/components/document-upload-card.tsx | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ApiCore-Frontend/src/app/(app)/settings/automation/create-webhook-dialog.tsx b/ApiCore-Frontend/src/app/(app)/settings/automation/create-webhook-dialog.tsx index 3cef3b2..1c1aad3 100644 --- a/ApiCore-Frontend/src/app/(app)/settings/automation/create-webhook-dialog.tsx +++ b/ApiCore-Frontend/src/app/(app)/settings/automation/create-webhook-dialog.tsx @@ -75,9 +75,13 @@ export function CreateWebhookDialog() { async function copySecret() { if (!createdSecret) return; - await navigator.clipboard.writeText(createdSecret); - setCopied(true); - toast.success("Secret kopiert"); + try { + await navigator.clipboard.writeText(createdSecret); + setCopied(true); + toast.success("Secret kopiert"); + } catch { + toast.error("Secret konnte nicht kopiert werden"); + } } return ( diff --git a/ApiCore-Frontend/src/components/document-upload-card.tsx b/ApiCore-Frontend/src/components/document-upload-card.tsx index 8f0aebb..e26e697 100644 --- a/ApiCore-Frontend/src/components/document-upload-card.tsx +++ b/ApiCore-Frontend/src/components/document-upload-card.tsx @@ -129,7 +129,11 @@ export function DocumentUploadCard({