From 94307ac73330d9f81699a4b8bd3cb7ae82bd8bf1 Mon Sep 17 00:00:00 2001 From: Bobby Kolev Date: Thu, 30 Jan 2025 17:49:15 +0200 Subject: [PATCH] Send Sentry error on onCloseConnection of a whiteboard (#7576) --- src/core/apollo/graphqlLinks/httpLink.ts | 2 +- .../whiteboard/WhiteboardDialog/WhiteboardDialog.tsx | 1 + .../excalidraw/CollaborativeExcalidrawWrapper.tsx | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/apollo/graphqlLinks/httpLink.ts b/src/core/apollo/graphqlLinks/httpLink.ts index 8071c116c7..590fbe16d5 100644 --- a/src/core/apollo/graphqlLinks/httpLink.ts +++ b/src/core/apollo/graphqlLinks/httpLink.ts @@ -50,7 +50,7 @@ export const httpLink = (graphQLEndpoint: string, enableWebSockets: boolean) => uploadLink ); } catch (error) { - logWarn(error as Error, { category: TagCategoryValues.WS }); + logWarn(error as Error, { category: TagCategoryValues.WS, label: 'Failed to create ws link' }); } } return uploadLink; diff --git a/src/domain/collaboration/whiteboard/WhiteboardDialog/WhiteboardDialog.tsx b/src/domain/collaboration/whiteboard/WhiteboardDialog/WhiteboardDialog.tsx index 77c841a2e0..5e2e141b33 100644 --- a/src/domain/collaboration/whiteboard/WhiteboardDialog/WhiteboardDialog.tsx +++ b/src/domain/collaboration/whiteboard/WhiteboardDialog/WhiteboardDialog.tsx @@ -47,6 +47,7 @@ export interface WhiteboardDetails { preview?: { id: string; } & PreviewImageDimensions; + url?: string; }; createdBy?: { id: string; diff --git a/src/domain/common/whiteboard/excalidraw/CollaborativeExcalidrawWrapper.tsx b/src/domain/common/whiteboard/excalidraw/CollaborativeExcalidrawWrapper.tsx index 0b13a33342..93b4c0f759 100644 --- a/src/domain/common/whiteboard/excalidraw/CollaborativeExcalidrawWrapper.tsx +++ b/src/domain/common/whiteboard/excalidraw/CollaborativeExcalidrawWrapper.tsx @@ -28,6 +28,7 @@ import useWhiteboardDefaults from './useWhiteboardDefaults'; import Loading from '@/core/ui/loading/Loading'; import { Identifiable } from '@/core/utils/Identifiable'; import { lazyWithGlobalErrorHandler } from '@/core/lazyLoading/lazyWithGlobalErrorHandler'; +import { TagCategoryValues, error as logError } from '@/core/logging/sentry/log'; const FILE_IMPORT_ENABLED = true; const SAVE_FILE_TO_DISK = true; @@ -73,7 +74,7 @@ const useActorWhiteboardStyles = makeStyles(theme => ({ })); export interface WhiteboardWhiteboardEntities { - whiteboard: Identifiable | undefined; + whiteboard: (Identifiable & { profile?: { url?: string } }) | undefined; filesManager: WhiteboardFilesManager; lastSavedDate: Date | undefined; } @@ -165,6 +166,12 @@ const CollaborativeExcalidrawWrapper = ({ if (isOnline) { setupReconnectTimeout(); } + // event if it's duplicated by the httpLink and Portal handlers, let's log this closeConnection one + // with additional info here #7492 + logError('WB Connection Closed', { + category: TagCategoryValues.WHITEBOARD, + label: `WB ID: ${whiteboard?.id}; URL: ${whiteboard?.profile?.url}; Online: ${isOnline}`, + }); }, onInitialize: collabApi => { combinedCollabApiRef.current = collabApi;