From 83d36d345f14925b831c84b81addb35c51caba26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Mon, 8 Jun 2026 18:42:47 +0200 Subject: [PATCH] Propagate DB errors and clipboard failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The common tracker pattern show command swallowed every error from loading the linked common third party, hiding real database failures behind silent partial output. Only tolerate ErrResourceNotFound now and wrap any other error so the command fails loudly. In the console, the copy-to-clipboard button reported success unconditionally. Await the clipboard write and surface an error toast when it rejects, guarding against a missing common tracker id. Signed-off-by: Émile Ré --- .../TrackerPatternPropertiesSection.tsx | 14 ++++++++++++-- pkg/proboctl/commontrackerpattern/show.go | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/trackers/_components/TrackerPatternPropertiesSection.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/trackers/_components/TrackerPatternPropertiesSection.tsx index b95b3f7bf..e7ab4aada 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/trackers/_components/TrackerPatternPropertiesSection.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/trackers/_components/TrackerPatternPropertiesSection.tsx @@ -118,8 +118,18 @@ export function TrackerPatternPropertiesSection({ type="button" className="p-1 rounded hover:bg-bg-hover transition-colors cursor-pointer" onClick={() => { - void navigator.clipboard.writeText(pattern.commonTrackerPatternId); - toast({ title: __("Copied"), description: __("Common Tracker ID copied to clipboard"), variant: "success" }); + const commonTrackerPatternId = pattern.commonTrackerPatternId; + if (!commonTrackerPatternId) { + return; + } + void (async () => { + try { + await navigator.clipboard.writeText(commonTrackerPatternId); + toast({ title: __("Copied"), description: __("Common Tracker ID copied to clipboard"), variant: "success" }); + } catch { + toast({ title: __("Error"), description: __("Failed to copy Common Tracker ID"), variant: "error" }); + } + })(); }} > diff --git a/pkg/proboctl/commontrackerpattern/show.go b/pkg/proboctl/commontrackerpattern/show.go index 44f4af97a..91f135910 100644 --- a/pkg/proboctl/commontrackerpattern/show.go +++ b/pkg/proboctl/commontrackerpattern/show.go @@ -70,7 +70,11 @@ func newCmdShow(f *cmdutil.Factory) *cobra.Command { if pattern.CommonThirdPartyID != nil { var party coredata.CommonThirdParty - if err := party.LoadByID(ctx, conn, *pattern.CommonThirdPartyID); err == nil { + if err := party.LoadByID(ctx, conn, *pattern.CommonThirdPartyID); err != nil { + if !errors.Is(err, coredata.ErrResourceNotFound) { + return fmt.Errorf("cannot load common third party: %w", err) + } + } else { thirdPartyName = party.Name } }