From 83800bda54ab99e8af7d9ee9f594714edbbd831b Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 17 Jan 2024 19:06:38 +0000 Subject: [PATCH] fix: speculative change to stop empty error ending up in Sentry --- frontend/src/lib/components/Sharing/SharingModal.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/Sharing/SharingModal.tsx b/frontend/src/lib/components/Sharing/SharingModal.tsx index c81d25ef30fbe..772ab68abd05a 100644 --- a/frontend/src/lib/components/Sharing/SharingModal.tsx +++ b/frontend/src/lib/components/Sharing/SharingModal.tsx @@ -19,6 +19,7 @@ import { DashboardCollaboration } from 'scenes/dashboard/DashboardCollaborators' import { InsightModel, InsightShortId, InsightType } from '~/types' import { sharingLogic } from './sharingLogic' +import {captureException} from "@sentry/react"; export const SHARING_MODAL_WIDTH = 600 @@ -114,7 +115,14 @@ export function SharingModalContent({ void copyToClipboard(shareLink, 'link')} + onClick={() => { + // TRICKY: there's a chance this was sending useless errors to Sentry + // even when it succeeded, so we're explicitly ignoring the promise success + // and naming the error when reported to Sentry + copyToClipboard(shareLink, 'link') + .then(() => {}) // purposefully no-op + .catch((e) => captureException(new Error('unexpected sharing modal clipboard error: ' + e.message))); + }} icon={} > Copy public link